Thursday, July 22, 2010

Why doesn't my UIImageView respond to taps?

If you're trying to make a UIImageView respond to a tap or other gesture and it's being stubborn and just ignoring you, make sure you've set userInteractionEnabled to YES. You can do this programmatically after the UIImageView is created or loaded or in the Attributes Inspector pane in Interface Builder if the UIImageView is defined in a NIB file. Naturally, userInteractionEnabled defaults to NO.

3 comments:

Pascal said...
This comment has been removed by the author.
Don McCaughey said...

Glad it helped -- I was tearing my head out over this one also!

Pascal said...

Ah man! I've been losing so much precious time because of this. Thanks!!!

Pascal