{"id":2633,"date":"2017-09-27T15:30:34","date_gmt":"2017-09-27T22:30:34","guid":{"rendered":"http:\/\/www.wellgolly.com\/?p=2633"},"modified":"2017-09-27T15:30:34","modified_gmt":"2017-09-27T22:30:34","slug":"willanimaterotationtointerfaceorientation-duration-deprecated","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=2633","title":{"rendered":"willAnimateRotationToInterfaceOrientation: duration: deprecated"},"content":{"rendered":"<p>After iOS 8 willAnimateRotationToInterfaceOrientation is no longer supported. After some experimenting I found that a drop-in replacement for:<br \/>\n<pre><code class=\"preserve-code-formatting\">\n- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration {\n\n&nbsp;&nbsp;&nbsp;&nbsp; ... code\n\n} \n<\/code><\/pre><\/p>\n<p>is<\/p>\n<p><pre><code class=\"preserve-code-formatting\">\n- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id&lt;UIViewControllerTransitionCoordinator&gt;)coordinator {\n&nbsp;&nbsp;&nbsp;&nbsp;[coordinator animateAlongsideTransition:^(id&lt;UIViewControllerTransitionCoordinatorContext&gt; context)\n&nbsp;&nbsp;&nbsp;&nbsp; {\n\n&nbsp;&nbsp;&nbsp;&nbsp; ... code\n\n&nbsp;&nbsp;&nbsp;&nbsp; } completion:^(id&lt;UIViewControllerTransitionCoordinatorContext&gt; context)\n&nbsp;&nbsp;&nbsp;&nbsp; {\n\n&nbsp;&nbsp;&nbsp;&nbsp; }];\n&nbsp;&nbsp;&nbsp;&nbsp;[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];\n}\n<\/code><\/pre><\/p>\n<p>In case it isn\u2019t clear, replace the method and then after your existing code, paste in the completion code and call super.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After iOS 8 willAnimateRotationToInterfaceOrientation is no longer supported. After some experimenting I found that a drop-in replacement for: &#8211; (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration { &nbsp;&nbsp;&nbsp;&nbsp; &#8230; code } is &#8211; (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id&lt;UIViewControllerTransitionCoordinator&gt;)coordinator { &nbsp;&nbsp;&nbsp;&nbsp;[coordinator animateAlongsideTransition:^(id&lt;UIViewControllerTransitionCoordinatorContext&gt; context) &nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp; &#8230; code &nbsp;&nbsp;&nbsp;&nbsp; } completion:^(id&lt;UIViewControllerTransitionCoordinatorContext&gt; context) &nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp; }]; &nbsp;&nbsp;&nbsp;&nbsp;[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; } In case it isn\u2019t &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=2633\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">willAnimateRotationToInterfaceOrientation: duration: deprecated<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-2633","post","type-post","status-publish","format-standard","hentry","category-ios"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2633"}],"version-history":[{"count":0,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2633\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}