I have 3 UIViews, layered on top of one large uiview. I want to know if the user touches the top one and not care about the other ones. I will have a couple of buttons in th
This can also be done the following way.
First find the location of the touch in the view you care about:
CGPoint location = [touches.anyObject locationInView:viewYouCareAbout];
Then see if the point is within the bounds of the view:
BOOL withinBounds = CGRectContainsPoint(viewYouCareAbout.bounds, location);
Then if it's within bounds, perform your action.
This can be done with one statement, which for example, can be used directly within an if statement:
CGRectContainsPoint(viewYouCareAbout.bounds, [touches.anyObject locationInView:viewYouCareAbout])