Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In a <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html" rel="nofollow"><code>UIViewController</code></a> subclass, you can override one (or more) of these methods:</p> <blockquote> <ul> <li><code>willRotateToInterfaceOrientation:duration:</code></li> <li><code>willAnimateRotationToInterfaceOrientation:duration:</code></li> <li><code>didRotateFromInterfaceOrientation:</code></li> <li><code>willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:</code></li> <li><code>didAnimateFirstHalfOfRotationToInterfaceOrientation:</code></li> <li><code>willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:</code></li> </ul> </blockquote> <p>From the documentation notes for <a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/willRotateToInterfaceOrientation%3aduration%3a" rel="nofollow"><code>willRotateToInterfaceOrientation:duration:</code></a>:</p> <blockquote> <p>Subclasses may override this method to perform additional actions immediately prior to the rotation. For example, you might use this method to disable view interactions, stop media playback, or temporarily turn off expensive drawing or live updates. You might also use it to swap the current view for one that reflects the new interface orientation. When this method is called, the interfaceOrientation property still contains the view’s original orientation.</p> </blockquote> <p>Like so:</p> <pre><code>- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { if (toInterfaceOrientation == UIInterfaceOrientationPortrait) { // do a thing } else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { // some other thing } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload