ios - 方向限制在 iPad 上不起作用
问题描述
我有应用程序只是显示首页。
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
statusBarColor: Colors.transparent
));
return MaterialApp(
theme: ThemeData(
),
home: TopPage(title: 'flutter'),
);
}
}
class TopPage extends StatefulWidget {
TopPage({Key key, this.title}) : super(key: key);
final String title;
@override
_TopPageState createState() => _TopPageState();
}
class _TopPageState extends State<TopPage> {
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
}
}
我以此来限制方向
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
它修复了 Android /Android 平板电脑 / iPhone 上的仅方向纵向。
但是仅在 iPad 中。
它旋转到横向。
如何在 iPad 上停止旋转??
在我的 Xcode Deployment Info.
-> 1Device Orientation`
Portlait
Lanscape Left
Landscape Right
被检查。
因为我需要在其他页面上旋转TopPage
解决方案
默认情况下,iPad 上的应用程序会选择 iPad 多任务处理,并且预计会在所有四个方向上旋转。甚至没有咨询它对优选方向的实现。
UIRequiresFullScreen
它可以通过在其Info.plist 中设置来选择退出。
推荐阅读
- flutter - Flutter Web 中如何使用 CheckBoxListTile 和 PopupMenuButton?
- if-statement - 使用 IF 控制器在 jmeter 中重新运行请求
- node.js - Puppeteer 无法启动浏览器
- ruby-on-rails - 如何在没有原始的全球化字符串中转义编码?
- visual-studio-code - 如何增加线路限制?
- python-3.x - Python多处理锁列表
- java - 如何扩展 SimpleJpaRepository 并使用 getQueryHints()
- multithreading - 是否有一个程序来平衡集群中的单线程程序?
- php - 发送 POST 请求:url 中缺少斜杠会触发重定向 GET 请求
- php - setcookie 在 PHP 中从一个页面到另一个页面不起作用