I am trying to display an image full screen when the user rotates the iPhone to either landscape orientation. To achieve this I have adding a modal of a full screen view controller when the user rotates from portrait to landscape. Then when the user rotates back to portrait it should dismiss the modal.
All of the views are presented in a TabBarViewController and all view controllers are transitioned with segues.
NOTE: This is the only view in the application that rotates to landscape.
THE PROBLEM
When I dismiss the modal, the TabBarViewController is still rotated landscape when the phone is in the portrait orientation. If I navigate away from the view and rotate, the view is presented in the proper orientation.
Edit The status bar with the time, battery, ect does rotate. The navigation bar, tab bar, and view on the screen do not rotate (stay landscape when held in portrait).
UIViewController A
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if(UIInterfaceOrientationLandscapeLeft == toInterfaceOrientation ||
UIInterfaceOrientationLandscapeRight == toInterfaceOrientation){
// USE MODAL TO PRESENT FULLSCREEN
UIViewController *fullViewController = [[FullScreenViewController alloc] init];
[self.navigationController presentViewController:fullViewController animated:NO completion:nil];
}
}
FullScreenViewController
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if(toInterfaceOrientation == UIInterfaceOrientationPortrait){
[self dismissViewControllerAnimated:true completion:nil];
}
}