On Jun 24, 2011, at 1:36 PM, Fritz Anderson wrote:

> UIImageView is not a control, so it doesn't have built-in handlers for 
> touches that would feed a target-action pair. You'll have to make a subclass 
> of UIImageView (in my experience it tolerates subclassing well), and add your 
> own touchesBegan/Moved/Cancelled/Ended methods.

Yeesh, talk about a sledgehammer approach.

You can simply attach a UITapGestureRecognizer to the view, turn on user 
interaction, and you're done.

Or you can use a UIButton without a bezel and show your image in the bezel, and 
then just wire up the button like you would any other button.  Tap detection is 
built into the system.  It's not worth rebuilding that when it's baked into the 
frameworks.

Dave
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to