I have 7 view controllers in my application all are in Portrait mode. Now i need to display another view(8th view) which supports both the orientations. I have implemented these three methods but screen is not rotating in landscape mode. Please suggest me.
- (BOOL)shouldAutorotate{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
You have to implement the following in the appDelegate:
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return self.rotateToLandScape ?
UIInterfaceOrientationMaskAllButUpsideDown :
UIInterfaceOrientationMaskPortrait;
}
then you should set the self.rotateToLandScape to true in the 8th screen.