簡體   English   中英

定位方法不適用於iPhone plus設備

[英]Orientation Method not working for iPhone plus devices

以下提到的方向委托方法在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。

希望這可以幫助。 請讓我知道是否需要更多說明。 這種方法對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM