作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
下面提到的方向委托(delegate)方法在 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>
请指导我解决这个问题。
最佳答案
尝试在 View 中添加通知
UIDeviceOrientationDidChangeNotification
并检查它是否出现在方法中。
此外,您在 UIDeviceOrientationDidChangeNotification
方法中返回“否”,请尝试返回"is"。
希望这有帮助。如果您需要更多解释,请告诉我。这种方法对我来说很有效。
关于ios - 方向方法不适用于 iPhone plus 设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56854258/
我是一名优秀的程序员,十分优秀!