簡體   English   中英

支持所有方向xcode

[英]support all orientations xcode

我已經以編程方式創建了所有視圖,而IB則沒有。 我的視圖包含導航控制器,表視圖,按鈕,選項卡欄。 現在,我應該如何使我的應用程序支持iOS 5和iOS 6的所有方向。

在您的所有UIViewController -s中編寫以下代碼:

- (NSInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}
- (BOOL)shouldAutorotate {
    return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return YES;
}

您是否嘗試過設置Project Target的Summary窗格中所支持的設備方向(如附圖所示)?

在此處輸入圖片說明

在iOS 6中已更改:

- (NSInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

暫無
暫無

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

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