Question

I've created a board of UIImageViews, that are held within a single object as an NSArray. all the imageviews are displayed as subviews of the 'board'(the object that holds the array). What I would like to do is when I touch any of the individual squares of the board (the imageviews) that the one that is touched is the one that picks up the event. Currently the board picks up all the touch events. passing the touches automatically to nextResponder doesn't work, since there isn't a single nextResponder, but many, with a single one being the correct one.

Was it helpful?

Solution

By default, UIImageView overrides the value of the userInteractionEnabled property to NO (see http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImageView_Class/Reference/Reference.html#//apple_ref/occ/instp/UIImageView/userInteractionEnabled). This is what is causing your UIImageViews to not receive touch events, and so they are accepted by the board superview.

To make it so your UIImageViews receive touch events, just set the userInteractionEnabled property to YES.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top