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:

  1. This comment has been removed by the author.

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

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

    Pascal

    ReplyDelete