ios - 方向方法不适用于 iPhone plus 设备
问题描述
下面提到的方向委托方法在 iOS plus 设备(iPhone 8plus/7plus/6plus...)的情况下不调用
我的定位方法代码是:
注意:横向右复选框默认未选中。
- (BOOL)shouldAutorotate {
return NO;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscapeRight;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationLandscapeRight;
}
我的 info.plist 文件是:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
请在这个问题上指导我。
解决方案
尝试在视图中添加通知
UIDeviceOrientationDidChangeNotification
并检查它是否出现在方法中。
此外,您在UIDeviceOrientationDidChangeNotification
方法中返回 No 尝试返回 YES。
希望这可以帮助。如果您需要更多解释,请告诉我。这种方法对我有用。
推荐阅读
- r - ggplot2 函数中的平均值和中值箱线图图例
- javascript - 当输入是属性值 Javascript 的数组时,从 Array 对象中删除具有相同属性值的对象
- python - 在熊猫数据框中移动和恢复多行
- flutter - 使用 image_picker_web (FLUTTER-WEB) 加载微调器
- angular - 日期范围过滤不填充表格角度材料
- angular - 生产模式下的 Nebular NbRoleProvider 问题
- c++ - Xode 项目无法编译一个简单的 C++ 类
- reactjs - 如何使用 Amplify DataStore 将数据同步到 AWS DynamoDB?
- javascript - 在 K6 的所有 API 中参数化相同的变量
- python - 替换不可编码的字符