I want to rotate a imageView using the following code:
[UIView animateWithDuration:.25 animations:^{
self.imageView.transform = CGAffineTransformRotate(self.plusView.transform, M_PI_4);
}];
the wired thing is that: if I run this code without auto layout, every thing is fine. but when using autolayout, the image view shift a litter pixel before rotate, why?
When using auto layout in Xcode 5, you need to add a constraint to fix the horizontal center and vertical center of the imageView in its container. If you are using storyboards, this can be easily done with the constraints options. You will also need to fix the width and height with constraints if you don't want the imageView auto-resized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With