Autolayout and Device Orientation-Collection of common programming errors
The best approach is to use neither. Instead, configure your constraints correctly so that no programmatic changes are required on rotation. The Auto Layout runtime will maintain the views in position as you already have specified.
Updating constraints other than changing the value of .constant
is a real performance hit and should be avoided.
Using viewWillLayoutSubviews
is not necessary. Auto Layout methods are updateViewConstraints
(for the view controller), and updateConstraints
(in the views).