【问题标题】:Iphone Portraits mode switching back to landscape Mode is not Working AutomaticallyIphone Portraits 模式切换回横向模式无法自动工作
【发布时间】:2014-01-08 14:56:36
【问题描述】:

我的应用程序在肖像模式下正确启动并且运行良好,但是在我的应用程序中,当我将应用程序视图从仅支持横向模式切换到同时支持这两种模式的某些视图时,某些视图仅支持横向模式和一些同时支持横向和纵向模式方向并将设备旋转到纵向并点击后退按钮,横向视图不会自动旋转

我使用下面的代码来设置方向

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


- (BOOL)shouldAutorotate
{
    return YES;
}




- (NSInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft;
}

谢谢

【问题讨论】:

    标签: ios iphone xcode ios7 uiinterfaceorientation


    【解决方案1】:

    编辑这些行

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

    作为

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        if (toInterfaceOrientation == UIInterfaceOrientationMaskLandscapeLeft) {
            return YES;
        }
        else {
            return NO;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-03-05
      • 2010-10-24
      • 2010-12-10
      • 2011-01-04
      • 2014-07-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-02
      • 2012-04-21
      相关资源
      最近更新 更多