0

デバイスの向きが機能しない理由がわかりません。

プロジェクトのプロパティで:

ここに画像の説明を入力

私のコードには次のものがあります。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
   return ((interfaceOrientation == UIInterfaceOrientationPortrait) || 
   (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || 
   (interfaceOrientation ==UIInterfaceOrientationLandscapeRight));
}

私は自分のiPhoneでそれをプローブし、変化しません。

何か不足していますか?

前もって感謝します

編集済み (info.plist)

ここに画像の説明を入力

4

3 に答える 3

0

コードのどこにshouldAutorotateToInterfaceOrientation:実装されていますか? のすべてのサブクラスのメソッドである必要がありUIViewControllerます。

にログ ステートメントまたはブレークポイントを配置して、機能していることを確認してくださいshouldAutorotateToInterfaceOrientation:。呼び出されていない場合は、別の場所にあるビュー コントローラーが有効な向きを決定しています。

于 2012-08-28T06:21:14.753 に答える
0

info.plistでファイルを開き、配列型XCodeの行を追加します。Supported interface orientation

その横にあるプラス ボタンを押して、使用するすべての方向を一覧表示します。iPhoneと で異なる設定を行うことができますiPad

于 2012-08-27T15:05:46.390 に答える
0
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if((interfaceOrientation == UIInterfaceOrientationPortrait) ||
   (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)||
   (interfaceOrientation == UIInterfaceOrientationLandscapeRight))
{
    return YES;
}

return NO;

}
于 2012-08-27T21:05:04.230 に答える