Since iOS6, you should not be using willRotateToInterfaceOrientation:
and didRotateFromInterfaceOrientation:
. These are only called on the front-most presented view controller, and will not be called on others. This means if you have a pushed view controller or a presented view controller, all others will not layout correctly.
Instead, you should always use viewWillLayout
and viewDidLayout
to handle rotation. They are both called inside an animation block, so anything you do which is animatable, will be animated.
For positioning views, you can either set the frames yourself, or use auto-layout constraints and adjust the constraints in viewDidLayout
. If you go the auto-layout route, never remove and add constraints. Use the same constraints as much as possible and just adjust their constant
values.