ZoomToRect:将肖像图像中的矩形转换为缩放以适应风景的相同图像
我有以下问题。
我有 UIImageView,它以纵向模式 768 x 1024 全屏显示图像。
在位置 200,200 处,我有一个宽度为 100,100 ... CGRect(200,200,100,100) 的 CGRect 显示,
直到这里一切都很好。
现在,如果我将设备转为横向,图像会缩放(缩放以适合)并以 1024 x 768 横向格式为中心
问题是,我的矩形 200,200,100,100 太大了......这似乎是合乎逻辑的,因为在横向中图像按比例缩小...
问题: 有没有一种简单的方法来转换我的 200,200,100,100 以适应景观表示?
问候, 南多
i have the following problem.
i have UIImageView which displays an image in fullscreen in portrait mode 768 x 1024.
At position 200,200 i have a CGRect displayes with width 100,100 ... CGRect(200,200,100,100)
Everything fine until here.
Now if i turn the device to landscape, the image gets scaled (scale to fit) and centered to the 1024 x 768 landscape format
No the problem is, that my rectangle 200,200,100,100 is too big... what seems to be logical because in lanscape the image is scaled down...
Question:
Is there a easy way to transform my rect 200,200,100,100 to fit to the landscape representation?
greetings,
nando
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过使用CALayerTransform3d。它可以让您进行几乎任何您可以想象的转换,并提供动画工具。将变换设置为旋转 90 度将使您处于横向方向。这就是您要找的吗?
Have you tried using CALayerTransform3d. It lets you do pretty much any transform you can imagine and gives animation tools as well. Setting the transform to rotate 90 degrees would put you in a landscape orientation. Is that what you are looking for?