我有一个UIImageView
,当我触摸它时,我可以通过以下方式获得触摸的位置:
[touch locationInView:theUIImageView]
问题是,当我使用以下命令旋转UIImageView时:
theUIImageView.transform = CGAffineTransformMakeRotation(DegreesToRadians(arc4random()%15));
[touch locationInView:theUIImageView]
不再返回水龙头的正确位置! *喘气!
关于如何获得real tap location
的任何建议?
选择要在 locationInView 中使用的其他视图(可能是父视图,未旋转的内容)。如果需要与此处不同的坐标系,则始终可以在旋转之前根据 UIImageView 的帧添加自己的偏移。