Christian Gossain
Christian Gossain

Reputation: 5972

CGAffineTransformMakeRotation() is resizing image on iPad?

I'm my application I have a UIImage view that is set up with an image in my view's nib file. In the view did load method of my view controller I rotate the image using the following line,

self.myImage.transform = CGAffineTransformMakeRotation(-126 * M_PI / 180);

Now on the iPhone version of my app my image is getting rotated by -126° just fine. However I've just recently started working on an iPad version of my app and when I use the above line of code to rotate the image it also gets resized?

As far as my eyes can tell it seems as though the width and height are being swapped?

Is there something I missed?

NOTE: If it helps i'm also setting the anchor point using,

[myImage.layer setAnchorPoint:CGPointMake( 0.5, 0.857142857 )];

And i'm running the code in he iPad 4.2 simulator

Upvotes: 1

Views: 1222

Answers (2)

Christian Gossain
Christian Gossain

Reputation: 5972

Well I've figured out my problem. First of all the only orientation that I'm supporting on the iPad is landscape mode, versus portrait mode on the iPhone version. By changing the orientation of the device the position of my image is also changing.

To fix the problem I had to adjust the Autosizing property of my UIImage in interface Builder, I enabled all the outer "bars" and disabled all the inner "bars" and that seemed to fix the problem.

Upvotes: 0

Akshay
Akshay

Reputation: 2983

"To fix the problem I had to adjust the Autosizing property of my UIImage in interface Builder, I enabled all the outer ones "bars" and disabled all the inner "bars" and that seemed to fix the problem."

Thanks Man , You are the life savior.. and Time too. :)

Upvotes: 1

Related Questions