繁体   English   中英

单视图iOS 6的方向问题

[英]orientation issue for a single view iOS 6

我的应用程序中有7个视图控制器,它们都处于纵向模式。 现在,我需要显示另一个支持两个方向的视图(第8个视图)。 我已经实现了这三种方法,但是屏幕不在横向模式下旋转。 请给我建议。

 - (BOOL)shouldAutorotate{
    return YES;
 }

 - (NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskAllButUpsideDown;
 }

 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationMaskAllButUpsideDown;
 }

您必须在appDelegate中实现以下功能:

- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {    

return self.rotateToLandScape ?
    UIInterfaceOrientationMaskAllButUpsideDown :
    UIInterfaceOrientationMaskPortrait;

}

那么您应该在第8个屏幕中将self.rotateToLandScape设置为true。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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