1

アプリでサポートする必要があるのは縦向きのみです。どうすればいいですか?追加してみました

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>

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

しかし、それは役に立ちません-とにかくビューが回転します。

前もって感謝します!

4

4 に答える 4

4

-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientationあなたの場合のBOOLを返す必要がありNOます。

于 2010-10-02T16:47:49.203 に答える
2

これは次のようになります。

 -(BOOL)     shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return interfaceOrientation == UIInterfaceOrientationPortrait 
           || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ;
}
于 2010-10-02T17:24:44.470 に答える
1

XCode 5(以前のバージョンについては不明)で、アプリ全体でのみポートレートモードをサポートする場合は、[プロジェクト設定]->[一般]->[展開情報]に移動し、[逆さま]、[左向き]、[右向き]のチェックを外します。

これはおそらく今それを行う最も簡単な方法です。

于 2014-02-22T09:04:55.820 に答える
0

iOS 6の場合、このメソッドも追加/オーバーライドする必要があるようですが、

-(BOOL)shouldAutorotate {
    return NO;
}
于 2013-03-06T10:10:18.480 に答える