Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 UIImageView,里面有一个 UIImage 设置为缩放纵横比。图像比宽高,并且在 UIImageView 的两侧都有一个透明区域。如何将 UIImageView 的点击位置转换为 UIImage 内的正确位置?
你有图像的原始宽度和高度。将它与视图的宽度和高度分开。将因子乘以您点击的 和image.size.height/view.frame.size.height点击的。yimage.size.width/view.frame.size.widthx
image.size.height/view.frame.size.height
y
image.size.width/view.frame.size.width
x