I have a rectangular UIView
whose edges are constrained to its superview. I need to rotate this view by 90 degrees, but then update its constraints so it stays correctly constrained to the superview. If I do
self.overlayView.transform = CGAffineTransformMakeRotation(M_PI * 0.5);
The view rotates, but the width and height stay fixed the wrong way round. Do I need to break the constraints and set them again so that the top is constrained to the superview's left, the left is constrained to the superview's bottom and so on?
Autolayout plays with the frame
to do its thing. As per the docs, the frame is undefined when the transform
is set to something other than the identity.
Based on this, it would appear that this is fixed in iOS8 (and indeed they reference the above docs, noting that as of iOS8 setFrame
method gets called on the transformed view).