简体   繁体   English

单视图iOS 6的方向问题

[英]orientation issue for a single view iOS 6

I have 7 view controllers in my application all are in Portrait mode. 我的应用程序中有7个视图控制器,它们都处于纵向模式。 Now i need to display another view(8th view) which supports both the orientations. 现在,我需要显示另一个支持两个方向的视图(第8个视图)。 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: 您必须在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. 那么您应该在第8个屏幕中将self.rotateToLandScape设置为true。

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

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