【问题标题】:Allow only LeftLandscape and RightLandscape orientation仅允许 LeftLandscape 和 RightLandscape 方向
【发布时间】:2010-06-08 14:39:02
【问题描述】:

我怎样才能让我的应用程序只允许横向,但同时(左和右)? 所以如果我旋转 180°,应用会旋转,但如果我纵向旋转,应用不会旋转?

谢谢

【问题讨论】:

    标签: iphone landscape screen-orientation


    【解决方案1】:

    尝试将其添加到您的 UIViewController:

    // Override to allow orientations other than the default portrait orientation.
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
                interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    }
    

    您可以在此处了解更多信息:UIViewController class reference

    【讨论】:

      猜你喜欢
      • 2014-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-08
      • 2017-03-26
      • 1970-01-01
      • 2021-08-18
      • 2023-02-04
      相关资源
      最近更新 更多