我有這個問題與iOS 6 SDK:我有一些意見,應該允許旋轉(例如一個視頻),有些不該。 現在我明白我必須檢查應用程序的Info.plist中的所有方向,然後在每個ViewController中進行排序,應該發生什麼。但它不工作!該應用始終旋轉到Info.plist中給出的方向。iOS 6旋轉:supportedInterfaceOrientations不起作用?
的Info.plist:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
是shouldn't被允許旋轉的任何視圖控制器:
//deprecated
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}
觀察:應用旋轉到橫向和縱向。任何想法爲什麼或我做錯了什麼?
乾杯, 馬克
編輯:我最近的研究結果還表明,如果你想在你的應用某些點有旋轉,你有來激活您的項目設置或信息全部四個旋轉方向的.plist。此替代方案是替代您的AppDelegate中的
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
,這會覆蓋Info.plist。現在不可能只在你的Info.plist中設置Portrait,然後通過重寫shouldAutorotateToInterfaceOrientation或supportedInterfaceOrientations在某個ViewController中進行旋轉。
這是根據NDA,在蘋果開發論壇發佈,我可以幫助。 –
這樣更好嗎?我想現在沒有人會在乎傷害NDA了...... – stk
它仍然是一個NDA,我也猜測這是一個常見問題,已經在開發論壇已經完全回答了 – wattson12