旋转 iPhone 并保持图像比例
我有一个 UIScrollView,其中包含 UIImageViews。所有图像都保持其图像比例 - 我的意思是,例如肖像图像高且窄,而风景图像短而宽。我屏幕上同时有大约 4 个图像(2 个垂直,2 个水平),然后我可以向下滚动。
我的问题是旋转设备。我
[self.imageScrollView setAutoresizingMask: UIViewAutoresizingFlexibleLeftMargin];// (etc)
对 imageView 使用相同的方法。但图像不保持其比例。如果我设置: UIViewAutoresizingFlexibleWidth - 图像很宽但高度太小 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth UIViewAutoresizingFlexibleHeight - 图像水平拉伸,而垂直拉伸则变小。
我需要旋转设备(纵向->横向),制作这两个图像(我彼此相邻)以填充间隙并保持这些图像的比例。
I have an UIScrollView, that contains UIImageViews. All images keep their image ratio - I mean that e.g. portrait image is high and narrow, while landscape image is short and wide. I have about 4 images at same time on screen (2 vertically, 2 horizontally), then I can scroll down.
My problem is rotating the device. I use
[self.imageScrollView setAutoresizingMask: UIViewAutoresizingFlexibleLeftMargin];// (etc)
And same method for imageView. But images don't keep their proportions. If I set:
UIViewAutoresizingFlexibleWidth - image is wide but heigh is too small
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight - image is stretched horizontally, while vertically it's way to small.
I need to rotate the device (portrait->landscape), make these 2 images (that I have next to each other) to fill gap and keep these images proportions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个功能..
Try this function..
这解决了我的问题^^
This solved my problem ^^