I have an app in which the user can interact with many objects. These are several UIButtons
, a few UILabels
and a lot of UIImageViews
.
The focus of all interaction centers around touching the UIImageView
objects. With a touch I can move the images around, tell them to do this or that. However, my current obstacle is in knowing how to properly have the app distinguish touches that occur when I touch a UIButton
.
Why? Well the logic within the Touches Began event is meant to be only for the UIImageViews
, however the moment that I touch a button, or any other object, the app is interpreting the touch as if it occurred for a UIImageView
object.
So, my approach boils down to: is there a good way of identifying if a touch occurred for a UIButton
, UIImageView
, UILabel
object? That way I can filter out the irrelevant touches in my app from the relevant ones.
EDIT:
The code below outlines how I capture the touch event, however I do not know how to know from the touch event whether it is a button or a view that I touched.
touch = [touches anyObject];
touchLocation = [touch locationInView:[self view]];