I want to rotate my UIImageView and set the size according to the aspect ratio. But I have some problems with that. First I paste here my code, then I explain the problem.
imageView.size = CGSizeMake(myWidth, myHeight);
[imageView setContentMode:UIViewContentModeCenter];
So these two lines set the size and the contentMode of my imageView. When I do this the image appears correctly. So when the device is rotated I catch the rotation notification and
if ([self isLandscape]) {
CGFloat aspect = myHeight / myWidth;
imageView.size = CGSizeMake(myWidth/aspect, myWidth);
[self rotateView:imageView withDegree:degree];
imageView.origin = CGPointMake(x, y);
} else {
[self rotateView:imageView withDegree:degree];
imageView.origin = CGPointMake(x, y);
imageView.size = CGSizeMake(myWidth, myHeight);
}
So then the rotation is done. But you can see that I am also do a resizing.
The problem is that my imageView has a minimum size which cannot be overridden.
But I figured out that if I change the contentMode property of my imageView from UIViewContentModeCenter to UIViewContentModeScaleAspectFit then it will work good but the size is smaller than what I expect. Why is that? :( How can I solve this? Please if you have any help!