简体   繁体   中英

UIImageView on rotating changes it width and height, how to get original height and width of normal state?

I have an image of width 200 and height 200 .when I rotate it to some degree say 60 degree then new width and height comes out to be 273,273 .

But I want to retrieve the same height and width 200*200 whatever rotation it has.

I am trying to scale that image to some ratio of back view size on which that image is placed. If back view reduces to half the image size is also reduced to half and same way if back view is increased to double image also increased to double. But when I rotate the image and try to change the frame of back view that image resizing works fine if it's not rotated but if it's rotated then resizing of back view ratio will not work fine with image ratio. Image either increase more or decrease. Generally it increases more than expected.

旋转后view.bounds.size不会改变

Image.transform=CGAffineTransformMakeRotation(angle); works perfectly fine . Check your image .... if it is in ping or jpeg etc. The issue is with the image I think not with the method .. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM