2011-09-02 85 views
2

我正在嘗試將自旋添加到我的應用程序,但遇到困難。我可以調整大小(一個TableView和幾個標籤),但狀態欄和窗口的其他部分(例如:標籤欄和導航控制器)保持縱向。我有一個從窗口到頂部ViewController的三視圖矩陣,我把shouldAutorotateToInterfaceOrientation中的所有內容都設置爲YES,除了在目標屬性的Summary部分中選擇倒置外,我還擁有其他所有內容,但它拒絕給出預算。這發生在模擬器和iPhone 4上。在XCode 4上都是4.3。我已經在視圖方向上搜索了蘋果文檔,但是還有其他地方需要設置它嗎?iOS不會旋轉

在我Info.plist,我有以下幾點:

<key>UISupportedInterfaceOrientations</key> 
<array> 
    <string>UIInterfaceOrientationPortrait</string> 
    <string>UIInterfaceOrientationLandscapeLeft</string> 
    <string>UIInterfaceOrientationLandscapeRight</string> 
</array> 
+2

的iOS不會旋轉,或者查看不會轉動? – EmptyStack

+0

@EmptyStak我猜的OP意味着「iOS不會旋轉我的意見」 – Yuji

+0

我知道我的意見不會自動旋轉,但iOs不是自動旋轉。我的印象是標籤欄和狀態欄會旋轉,但組件會被擠壓成縱向大小。 – Echilon

回答

5

我最終發現,如果你有一個UITabBarController,所有的標籤視圖都需要支持旋轉。應該記住節約一些時間:

  • 沒有會旋轉,直到所有的的UITabBarController支持旋轉
  • 選項卡如果您嘗試手動調整的事情當視圖旋轉時,它的容易得多設置您的筆尖中每個控件的尺寸屬性。設置錨位置和伸展規則,大部分事情似乎「只是工作」。
  • 分段控制似乎需要手動調整大小在- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration方法
0

在你的問題你的狀態

我把一切都在shouldAutorotateToInterfaceOrientation設置爲YES

,但我不確定你是什麼意思。如果你支持所有的方位,然後簡單地返回YES

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return YES; 
} 

這可能是因爲你已經打算在這裏什麼都(因爲你沒有張貼代碼)無法按預期工作。

+0

這就是我的意思。在'shouldAutorotateToInterfaceOrientation'方法中,我只是返回YES,並且調用了我可以從調試中看到的代碼,但視圖不旋轉。 – Echilon

+0

如果你打開你的' -info.plist'手動(*包括代碼編輯器,而不是屬性列表編輯器。*)的'UISupportedInterfaceOrientations'項下列出什麼方向? –