views:

200

answers:

1

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.

+1  A: 

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".

Nikolai Ruhe
http://pastie.org/527140 prints "Touched at x:0" always, no matter what.
Shoaibi
okay, got it.. it should have been %f
Shoaibi
Use -Wformat to avoid this error. There's also an Xcode setting for this.
Nikolai Ruhe
Any ideas at : http://pastie.org/527611
Shoaibi