简体   繁体   中英

orientation issue for a single view iOS 6

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM