Thank you for UITapGestureRecognizer!

Initially I didn’t think a whole lot about the UITapGestureRecognizer in iOS. I figured it might save someone some time wiring up some touch code, but outside of that I felt it was nothing more than a nice convenience. After today I am so thankful that some developers and managers at Apple included it into iOS for developers to use. 

In an application I am coding for the iPad I am using touchesBegan, touchesMoved and touchesEnded for certain user interaction behaviors. However I needed to also provide a tap behavior that didn’t need to muck with my touchesBegan and touchesEnded (rolling my own timer, adding needless complexity).

I just added a UITapGestureRecognizer that runs in addition to the touches code. Setting it’s cancelsTouchesInView property to NO means it won’t eat up all touches… so my other UI components still function perfectly. It’s a Godsend and with a few lines of simple code I’ve easily added the functionality that I needed. I was surprised how easy and straight-forward the development took me to put in place.

So whoever at Apple is responsible, I’d like to buy you a drink or three at the WWDC this year. Thank you.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *


3 + eight =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>