【问题标题】:How to disable set supportedInterfaceOrientations for Custom modalPresentationStyle如何为自定义modalPresentationStyle禁用设置supportedInterfaceOrientations
【发布时间】:2015-01-30 08:41:25
【问题描述】:

我有一个控制器,其中:

modalPresentationStyle = .Custom

我需要为此视图控制器使用纵向界面方向或禁用旋转。在这样的方法中:

supportedInterfaceOrientations(), shouldAutorotate()

我返回了所需的值,但它们什么都不做,控制器在出现时仍会旋转。当我使用某些系统默认的 modalPresentationStyle 时,会出现预期行为。

【问题讨论】:

    标签: ios iphone cocoa-touch ios8


    【解决方案1】:

    只需在您的自定义视图中添加这两个功能。 删除确实旋转,如果添加,将旋转方法或方向。 这将在所有方向打开,但在那之后没有改变,直到您关闭。

    - (BOOL)shouldAutorotate{
        return NO;
    }
    
    
    - (NSUInteger)supportedInterfaceOrientations{
        return UIInterfaceOrientationMaskAll; 
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-28
      • 2020-09-07
      • 1970-01-01
      • 1970-01-01
      • 2014-12-19
      • 2011-08-01
      相关资源
      最近更新 更多