Shoaibi
Shoaibi

Reputation: 879

Guess the touched UIImageView

I have multiple UIImageViews with userinteraction enabled. I am implementing touchesBegan, is there a way to guess which imageview was touched rather than making a rect based on all imageviews and check for the touch point existence in them?

I also have assigned different tags to each imageview.

Upvotes: 0

Views: 267

Answers (1)

Nikolai Ruhe
Nikolai Ruhe

Reputation: 81858

In your touchesBegan:withEvent: method you can check the UITouch object for its 'view' property. From the docs: "The value of the property is the view object in which the touch originally occurred".

Upvotes: 1

Related Questions