繁体   English   中英

如何在Xcode5中的ios7模拟器上停止人像和倒立?

[英]How to stop portrait and upside down on ios7 simulator in xcode5?

我的程序仅使用横向模式。 较早之前,我使用xcode 4.5,但现在不起作用,现在我使用xcode5。模拟器将其旋转四个方向。

我只需要左右景观。

在我的应用程序委托中

 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;//|UIInterfaceOrientationLandscapeRight;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
            interfaceOrientation == UIInterfaceOrientationLandscapeLeft );
}


-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

- (BOOL)shouldAutorotate{
    if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft ||[[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeRight)
    {
        return YES;
    }
    else{
        return NO;
    }
}

在我放的每个ViewController中

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

在此处输入图片说明

我这样设置的每个故事板viewconrtoller和导航视图控件。 在此处输入图片说明 我怎么解决这个问题

确保像这样在appDelegate中将Top Most控制器添加为rootViewController

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {  
        navigation=[[UINavigationController alloc]initWithRootViewController:self.viewController];  
        [self.window setRootViewController:navigation];  
    } 

暂无
暂无

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

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