• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to assign a method for touch event to a UIImageView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to assign a method for touch event to a UIImageView?


  • Subject: Re: How to assign a method for touch event to a UIImageView?
  • From: Dave DeLong <email@hidden>
  • Date: Fri, 24 Jun 2011 13:40:18 -0700

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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >How to assign a method for touch event to a UIImageView? (From: Jonathan Chacón Barbero <email@hidden>)
 >Re: How to assign a method for touch event to a UIImageView? (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: How to assign a method for touch event to a UIImageView?
  • Next by Date: Re: How to assign a method for touch event to a UIImageView?
  • Previous by thread: Re: How to assign a method for touch event to a UIImageView?
  • Next by thread: Re: How to assign a method for touch event to a UIImageView?
  • Index(es):
    • Date
    • Thread