On iOS 6, rotation handling has changed. There are two options to prevent the rotation:
- You can set your whole app to only support portrait orientation in your Info.plist.
You can override a method in your application delegate:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return UIInterfaceOrientationMaskPortrait; }
As that method is called on your delegate whenever the orientation changes or a new view controller is pushed, you can even use it to temporarily disable landscape display:
// In AppDelegate.h: @property (nonatomic) BOOL portraitOnly; // In AppDelegate.m: - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return _portraitOnly ? UIInterfaceOrientationMaskPortrait : UIInterfaceOrientationMaskAllButUpsideDown; } // to switch to portrait only: ((AppDelegate *)[UIApplication sharedApplication].delegate).portraitOnly = YES; // to switch back to allowing landscape orientations as well: ((AppDelegate *)[UIApplication sharedApplication].delegate).portraitOnly = NO;
Both methods are perfectly acceptable for App Store submission, as these only use published and documented behavior.