I have a UIImageView which is inside another UIView.
I rotate the UIImageView with something like:
object.transform=CGAffineTransformMakeRotation(angle)
When the outer UIView is not rotated, and can use CGAffineTransformMakeRotation to rotate the UIImageView, and it works properly.
However, When the outer UIView is rotated, and I then rotate the UIImageView (non-zero “angle” above) – the UIImageView appears “squashed” or “flattened”.
This seems to constantly get worse and worse as it is rotated through different angles.
Why is this happening? Is the outer UIView modifying the transformation matrix that I am then modifying again by explicity setting it?
How can I rotate a UIImageView within a rotated UIView and have it just rotate correctly?
Maybe your
UIIamgeViewis autoresized by it’s superview.You can try disable the autoresizing ability by setting:
imageView.autoresizingMask = UIViewAutoresizingNone;or if you just do not want iOS to automatically change the size of your imageView but still want it to automatically set the position for you, you can call:
imageView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin;Tell me if you still have problem.