0
I started a project, where I use a Custonnavigationcontroller to control the navigation of the screens.
In this project, only one viewcontroller can be rotated to Landscape mode. But the following problem occurs, thus:
1 - Start the app on Portrait 2 - I navigate to the screen 3 - I rotate the device and the screen goes into Landscape mode 4 - Keeping the app in Landscape mode, back to the previous screen, the app continues in Landscape and non-rotational to Portrait.
In other words: In Customnavigationcontoller, I determined that only 1 screen could be rotated to Landscape mode. However, when returning the previous screen the orientation is maintained in Landscape mode.
How could you rotate the screen that is in Landscape to to Portrait before it is removed?
I tried to use the code below, but without success:
-(void)viewWillDisappear:(BOOL)animated{
if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) ||
([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)) {
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
}
}
Guys, it was easier to do the project autolayout, than to do it :D but I will keep the question for didactic questions
– Tiago Amaral