0

I have a UIImageView and when I touch it I can get the location of the touch with:

[touch locationInView:theUIImageView]

The problem is that when I rotate the UIImageView with:

theUIImageView.transform = CGAffineTransformMakeRotation(DegreesToRadians(arc4random()%15));

the [touch locationInView:theUIImageView] no longer returns the correct location of the tap! *gasp!

Any suggestions on how to get the real tap location?

Devang
  • 11,258
  • 13
  • 62
  • 100
Parad0x13
  • 2,007
  • 3
  • 23
  • 38

1 Answers1

-1

Choose a different (possibly parent, something not rotated) view to use in locationInView. If you need a different coordinate system from there, you can always add your own offsets based on the frame of theUIImageView before the rotation.

Nick
  • 9,792
  • 7
  • 50
  • 60
  • Could you please elaborate? I'm not sure what your trying to explain – Parad0x13 Apr 11 '12 at 01:50
  • You call locationInView to get the location in a view. You happen to be using your rotated image view, but you can get the location of the touch inside the parent view by passing it to locationInView. – Nick Apr 11 '12 at 01:53