2012-06-03 27 views

回答

0

寫t他的所有視圖控制器:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 
+0

我仍然可以旋轉到橫向模式。 – coolcool1994

3

寫這篇文章中的所有視圖控制器

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return NO; 
} 
在項目的info.plist

變化

而且爲重點

<key>UISupportedInterfaceOrientationss</key> 
<array> 
    <string>UIInterfaceOrientationPortrait</string> 
    <string>UIInterfaceOrientationLandscapeLeft</string> 
    <string>UIInterfaceOrientationLandscapeRight</string> 
</array> 

值要

<key>UISupportedInterfaceOrientationss</key> 
<array> 
    <string>UIInterfaceOrientationPortrait</string> 
</array> 
+0

他說的是正確的。若要進一步擴展,有時在創建一些文件後設置設備方向時,舊文件不能自動更正。您必須自動執行此操作。所有這些更改後的新文件都應該已經正確。 – DGund

+0

這會給你一個** NSLog **條目告訴你支持至少一個方向,而不是僅僅返回NO使用@Maxim Mikheev的'shouldAutorotateToInterfaceOrientation'方法的答案 –

相關問題