繁体   English   中英

旋转 UIImageView touchLocationInView 不正确

[英]Rotated UIImageView touchLocationInView not correct

我有一个UIImageView ,当我触摸它时,我可以通过以下方式获得触摸的位置:

[touch locationInView:theUIImageView]

问题是当我旋转 UIImageView 时:

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

[touch locationInView:theUIImageView]不再返回点击的正确位置! *喘气!

关于如何获得real tap location的任何建议?

选择一个不同的(可能是父视图,未旋转的视图)在 locationInView 中使用。 如果你需要一个不同的坐标系,你总是可以在旋转之前根据 UIImageView 的框架添加你自己的偏移量。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM