簡體   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