簡體   English   中英

我不知道如何在iOS 6中進行縱向和顛倒

[英]I don't know how to do Portrait and Upside down in iOS 6

我在用:

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskPortrait; 

}

如何在iOS6中將它用於縱向和顛倒?

這適用於橫向左UIInterfaceOrientationMaskLandscapeLeft

這適用於Landscape right UIInterfaceOrientationMaskLandscapeRight

這對於兩個風景UIInterfaceOrientationMaskLandscape

您需要返回您希望支持的方向的有效位掩碼:

對於肖像和肖像顛倒:

- (NSUInteger)supportedInterfaceOrientations {

    return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);

}

您可以看到支持的方向掩碼列表

還需要注意的是,您還需要在支持的方向上顛倒縱向:

在此輸入圖像描述

您需要對每個支持的方向使用按位OR運算符。

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait |
        UIInterfaceOrientationMaskPortraitUpsideDown; 
}

為要支持的每個方向添加另一個按位OR。 通常,當您看到一個帶有“mask”一詞的常量時,它們就意味着以這種方式組合。

這里也有同樣的問題

你也應該解決你的問題。

  • 允許輪換
  • 頂部組件需要再次允許

仔細觀察那些方法,看似相似,但不是

暫無
暫無

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

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