user1226038
user1226038

Reputation: 77

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.

Upvotes: 0

Views: 496

Answers (2)

Wei Xiang
Wei Xiang

Reputation: 539

view.bounds.size would not change after the rotation

Upvotes: 1

IronManGill
IronManGill

Reputation: 7226

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 .. :)

Upvotes: 0

Related Questions