Get width of a resized image after UIViewContentModeScaleAspectFit

前端 未结 6 1656
忘了有多久
忘了有多久 2021-01-30 13:56

I have my UIImageView and I put an image into it that I resize like this:

UIImageView *attachmentImageNew = [[UIImageView alloc] initWithFrame:CGRectMake(5.5, 6.         


        
6条回答
  •  广开言路
    2021-01-30 14:35

    It has the reference of your original image, so always gives the same dimensions as of original image.

    To get the dimensions of new image you have to check aspect ratio. I have derived a formula for my need using different images of different size using Preview that how it resizes image according to its aspect ratio.

提交回复
热议问题