Resize UIImage and change the size of UIImageView

后端 未结 7 1009
梦谈多话
梦谈多话 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 04:58

    When you get the width and height of a resized image Get width of a resized image after UIViewContentModeScaleAspectFit, you can resize your imageView:

    imageView.frame = CGRectMake(0, 0, resizedWidth, resizedHeight);
    imageView.center = imageView.superview.center;
    

    I haven't checked if it works, but I think all should be OK

提交回复
热议问题