开发者

How to non-deforming rotate an image in UIImageView in UIView when device rotates?

开发者 https://www.devze.com 2023-01-13 07:47 出处:网络
I have a UIView with this structure inside it: UIView -- UIImageView -- -- UIImage The JPG image is vertical, and it\'s the same size of the device in the vertical orientation.

I have a UIView with this structure inside it:

UIView

-- UIImageView

-- -- UIImage

The JPG image is vertical, and it's the same size of the device in the vertical orientation.

I want the UIImage to rotate this as follow:

Device is vertical:

The image is shown full size (fills the screen)

Device is horizontal:

- 开发者_如何学运维The image width should match the device width in horizontal orientation

- The image height should be calculated to NOT DEFORM the image (so its bottom part will be out of the UIImageView)

I'm going crazy trying to solve this.

Anybody have already solved this problem?

Thank you in advance.


You could try playing around with the contentMode property of your UIImageView. Let me know if that worked.


You simply calculate and set the transform property of the views you want to deform.

0

精彩评论

暂无评论...
验证码 换一张
取 消