【问题标题】:How to override supportedInterfaceOrientations in Flutter?如何在 Flutter 中覆盖supportedInterfaceOrientations?
【发布时间】:2020-01-15 03:07:05
【问题描述】:

我试图阻止我的一些 UIViewController 在 iPhone 物理旋转时自动旋转。我知道如何通过覆盖这些方法supportedInterfaceOrientationsshouldAutorotate 以iOS 原生方式做到这一点。但是如何在 Flutter 中覆盖这些方法呢?或者在 Flutter 中有没有其他方法可以做到这一点?

【问题讨论】:

    标签: ios objective-c flutter


    【解决方案1】:

    您可以在 main() 方法中使用 SystemChrome.setPreferredOrientations: SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp);
    此外,将条目 UIInterfaceOrientationPortrait 添加到您的 plist

    【讨论】:

      猜你喜欢
      • 2016-12-08
      • 1970-01-01
      • 2019-12-10
      • 2019-12-31
      • 2019-11-10
      • 1970-01-01
      • 2018-02-05
      • 2019-05-21
      • 2012-12-17
      相关资源
      最近更新 更多