【发布时间】:2019-09-30 17:18:16
【问题描述】:
我将这个库用于我的 react native 项目:
react-native-orientation-locker
我想要实现的是在除一个屏幕之外的所有屏幕上锁定方向为纵向。这个库工作正常,除非用户在横向模式下关闭应用程序,然后尝试在横向模式下打开它。应用程序在很短的时间内以横向打开,然后旋转为纵向。但我不想看到它,而是想在应用启动时以纵向模式打开它。
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
/*if (the app has just been launched) {
return UIInterfaceOrientationMaskPortrait;
}*/
// else, use the library to manage and set orientation
return [Orientation getOrientation];
}
我不知道如何检查第一次启动以及在上面的 if 语句中放入什么
【问题讨论】:
标签: ios swift react-native orientation screen-orientation