Hello Jonathan,

There are several ways around this.

You can create a transparent UIButton laid out exactly where the image view is 
(and with the same autoresizing masks), then wiring up its action / target 
where desirable.

Another way is to add a UITapGestureRecognizer on the image view.  UIImageView 
might have its userInteractionEnabled property set to NO, if I am recalling 
correctly.

Besides subclassing, composition might work too! :)

-ev

On Jun 25, 2011, at 04:26, Jonathan Chacón Barbero wrote:

> Good evening,
> 
> I want to execute a method when the user touches a UIImageView.
> I designed my interface without Interface builder tools because I am blind.
> 
> I can add an action to a UIButton with this code:
> 
> [myButton addTarget:self action:@selector(onFotoClick:) 
> forControlEvents:UIControlEventTouchUpInside];
> 
> but this code doesn't work with an UIImageView.
> 
> How can I do this with this class?
> 
> thanks
> 
> 
> 
> 
> Regards
>       Jonathan Chacón Barbero
>   Accessibility, usability and new technologies consultant
> 
> Phone: +34 679953948
> e-Mail: jonathan.cha...@telefonica.net
> Blog: http://www.programaraciegas.es
> Twitter: http://www.twitter.com/jonathanchacon
> LinkedIn: http://es.linkedin.com/in/jonathanchacon
> Facebook: http://www.facebook.com/jonathan.chacon.barbero
> Messenger: tyf...@hotmail.com
> Skype: Tyflos_
> FaceTime: jonathan.cha...@telefonica.net
> 
> _______________________________________________
> 
> 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/ev%40monoceroi.com
> 
> This email sent to e...@monoceroi.com

_______________________________________________

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