This is in my AppDelegate, and runs on orientation change. When the application loads it ALWAYS loads as portrait mode. If I load the application while the device is in landscape mode this still executes as if the device was in portrait mode. Thats the first problem I have. The second is that after load when I rotate the device from portrait to landscape I get a thread break as notated below:
-(void)setOrientationView
{
UIDevice *currentDevice = [UIDevice currentDevice];
[currentDevice endGeneratingDeviceOrientationNotifications];
UIDeviceOrientation theOr = currentDevice.orientation;
if ( UIDeviceOrientationIsLandscape(theOr) && !isLandVisible )
{
NSLog(@"setLand");
isLandVisible = YES;
isPortVisible = NO;
[self.window.rootViewController pushViewController:portCont animated:YES]; // <Thread 1: breakpoint 2.1
}
if( UIDeviceOrientationIsPortrait(theOr) && !isPortVisible )
{
NSLog(@"setPort");
isPortVisible = YES;
isLandVisible = NO;
[self.window.rootViewController pushViewController:portCont animated:YES];
}
[currentDevice beginGeneratingDeviceOrientationNotifications];
}
I am pulling my hair out trying to support both orientations on load, with a storyboard app, and without dismissing views after they are viewed (necessary to prevent reloads of UIWebViews). So there are two problems that are just beyond me. Thanks SO.
The Advanced App Tricks section of the iOS App Programming Guide has some guidelines about
Launching in Landscape Mode, it could be that your answer lies within those few lines (if at all possible). Especially take care of theUIInterfaceOrientationin yourInfo.plistfile.