I am currently working on an app where I would like to transition from one screen to another when the user rotates the device to landscape view. I have this working, but the screen that is being transitioned out rotates to landscape view just as the next view is coming in. A common solution to preventing the current view from rotating is to return NO for the shouldAutoRotate method. However, I need this enabled in order to transition to the next screen. I've also toyed with [UIView setAnimationsEnabled:NO] in the willRotateToInterfaceOrientation but this only hides the animation, and still rotates the current view to landscape. Here are all related rotate methods:
-(BOOL)shouldAutorotate
{
return YES;
}
//Temporarily disable rotation animation
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[UIView setAnimationsEnabled:NO];
}
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[UIView setAnimationsEnabled:YES];
if(UIInterfaceOrientationLandscapeLeft)
[self performSegueWithIdentifier:@"landscapeView" sender:self];
}
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
Any suggestions? Thanks in advance.