Orientation always in Portrait iOS6

Right had to do a bit of research for this one, here is the fix I found that works from Natalie London

In your APP DELEGATE.m

NSString *reqSysVer = @"6.0";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];

if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending){
[window setRootViewController:viewController]; // This is for IOS6.....
}else{
[window addSubview: viewController.view]; //This is for < IOS6....... (the old way)
}

In your ROOTVIEWCONTROLLER.m //will only be compiled for IOS6

FOR LANDSCAPE USE THIS


- (NSUInteger) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationLandscapeRight;
}

- (BOOL) shouldAutorotate {
return YES;
}

FOR PORTRAIT USE THIS


- (NSUInteger) supportedInterfaceOrientations {
return  UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationPortrait;
}

- (BOOL) shouldAutorotate {
return YES;
}

The page I got this from is

https://devforums.apple.com/message/734618#734618

Leave a Reply

Your email address will not be published. Required fields are marked *