Ad

Our DNA is written in Swift
Jump

Author Archives rss

Draggable Buttons and Labels

luckysmiles asks:

Pls anyone help me…how to move controls(like button,label.. ) from one place to another using touch events in iphone..

There are 3 possibilities nowadays on how to enable items – that is UIViews and UIControls – to be draggable.

  • override touchesMoved
  • add a target/selector for dragging control events
  • add a pan gesture recognizer

All those are variations on essentially the same thing: the iOS delivers touches to your app and you have more or less intelligent plumbing to calculate a moving vector. Then you apply this delta to either the frame of the thing to be moved or, more intelligently change the item’s center property.

When I started building a sample I wanted to create a UIButton subclass with the added draggability and have this button be instantiated from a XIB. Now it turns out that you can only create custom buttons like this, not rounded rect buttons like you usually do. The reason for this being that the regular initWithFrame or initWithCoder for a subclassed UIButton would need to instead create a UIRoundedRectButton (private Apple class) to look like that.
Read more

We Moved!

It’s been quite some time in the making and it was the main reason for my lack of updates: Moving. For the longest time this blog was hosted on a virtual Windows server, but I finally had the guts to move to a dedicated Linux box…. and ditch Windows which I was at it.

In the past I had all my content under drobnik.com which made me somewhat unhappy because the analytics would always be a mixture of traffic going to my German-language personal blog and my English-language iPhone-Development blog. Another drawback was that I had to have a “disambiguation page” under the domain root directing people to any of the sub-sites. Yuck.

Now these are the sites hosted on the new server:

I spent most of the day today – not coding on iWoman 2.0 as I would have liked to – but working with my Linux guru to get the final kinks out of of this to be ready to call the move. A bit of URL hacking via a search&replace plugin, some manual file copying, plugin updating, URL rewriting/redirecting, claiming the sites in Google Webmaster Tools and submitting sitemaps and lots of other itsy-bitsies.

Well, that should have been it. Now that this blog again stands on terra firma I can resume writing the Q&A and recipe articles that people love to read on this blog.

UPDATE: The old server can still be reached via drobnik.net. I also am moving and consolidating my Subversion repositories on the new server. Until then you can simple substitude .net instead of .com in the repository URLs. For example: https://www.drobnik.net:8443/svn/DTBannerManager/ – you will have to re-accept the self-signed certificate.