{"id":5245,"date":"2014-03-30T20:00:42","date_gmt":"2014-03-30T20:00:42","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/autolayout-and-device-orientation-collection-of-common-programming-errors\/"},"modified":"2014-03-30T20:00:42","modified_gmt":"2014-03-30T20:00:42","slug":"autolayout-and-device-orientation-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/autolayout-and-device-orientation-collection-of-common-programming-errors\/","title":{"rendered":"Autolayout and Device Orientation-Collection of common programming errors"},"content":{"rendered":"<p>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.<\/p>\n<p>Updating constraints other than changing the value of <code>.constant<\/code> is a real performance hit and should be avoided.<\/p>\n<p>Using <code>viewWillLayoutSubviews<\/code> is not necessary. Auto Layout methods are <code>updateViewConstraints<\/code> (for the view controller), and <code>updateConstraints<\/code> (in the views).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5245","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5245"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5245\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}