简体   繁体   English

定位方法不适用于iPhone plus设备

[英]Orientation Method not working for iPhone plus devices

Below mentioned orientation delegate method not calling in case of iOS plus devices(iPhone 8plus/7plus/6plus...) 以下提到的方向委托方法在iOS plus设备(iPhone 8plus / 7plus / 6plus ...)下无法调用

My code for orientation methods is: 我的定向方法代码是:

Note: Landscape right checkbox is unselected by default. 注意:默认情况下,未选中“横向右移”复选框。

- (BOOL)shouldAutorotate {
    return NO;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscapeRight;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
     return UIInterfaceOrientationLandscapeRight;
}

My info.plist file is: 我的info.plist文件是:

<key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>

Please guide me on this issue. 请在这个问题上指导我。

Try adding a notification on view 尝试在视图上添加通知

UIDeviceOrientationDidChangeNotification

and check if it comes in the method. 并检查它是否包含在方法中。

Also you are returning No in your UIDeviceOrientationDidChangeNotification method try returning YES. 另外,您在UIDeviceOrientationDidChangeNotification方法中返回No,请尝试返回YES。

Hope this helps. 希望这可以帮助。 Do let me know if you need any more explanation. 请让我知道是否需要更多说明。 This approach has been worked for me. 这种方法对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM