Resize UIImage and change the size of UIImageView

后端 未结 7 1036
梦谈多话
梦谈多话 2020-12-13 04:37

I have this UIImageView and I have the values of its max height and max width. What I want to achieve is that I want to take the image (with any aspect ratio an

7条回答
  •  醉酒成梦
    2020-12-13 05:21

    I think what you want is a different content mode. Try using UIViewContentModeScaleToFill. This will scale the content to fit the size of ur UIImageView by changing the aspect ratio of the content if necessary.

    Have a look to the content mode section on the official doc to get a better idea of the different content mode available (it is illustrated with images).

提交回复
热议问题