Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your problem stems from the fact that by the time willRotateToInterfaceOrientation: is called, the view being rotated already has its orientation property set and the animation block handling the rotation is also ready to run on a separate thread. From <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html" rel="nofollow">the documentation</a>:</p> <blockquote> <p>This method is called from within the animation block used to rotate the view. You can override this method and use it to configure additional animations that should occur during the view rotation.</p> </blockquote> <p>I would suggest overriding the shouldAutorotateToInterfaceOrientation: method to fire your animation before returning YES for supported orientations:</p> <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations if (interfaceOrientation == (UIDeviceOrientationPortrait || UIDeviceOrientationPortraitUpsideDown) { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; theView.alpha = 0; [UIView commitAnimations]; } else { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; theView.alpha = 1; [UIView commitAnimations]; } return YES; } </code></pre> <p>This should ensure the animation runs before you ever set the orientation of UIViewController and fire the rotation animation. You may have to add a slight delay to get the effect your are looking for depending on the device hardware speed.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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