【发布时间】:2020-01-15 03:07:05
【问题描述】:
我试图阻止我的一些 UIViewController 在 iPhone 物理旋转时自动旋转。我知道如何通过覆盖这些方法supportedInterfaceOrientations 和shouldAutorotate 以iOS 原生方式做到这一点。但是如何在 Flutter 中覆盖这些方法呢?或者在 Flutter 中有没有其他方法可以做到这一点?
【问题讨论】:
标签: ios objective-c flutter
我试图阻止我的一些 UIViewController 在 iPhone 物理旋转时自动旋转。我知道如何通过覆盖这些方法supportedInterfaceOrientations 和shouldAutorotate 以iOS 原生方式做到这一点。但是如何在 Flutter 中覆盖这些方法呢?或者在 Flutter 中有没有其他方法可以做到这一点?
【问题讨论】:
标签: ios objective-c flutter
您可以在 main() 方法中使用 SystemChrome.setPreferredOrientations:
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp);
此外,将条目 UIInterfaceOrientationPortrait 添加到您的 plist
【讨论】: