2012-04-13 8 views
1

普遍的なアプリを作っていますが、初期の向きをiPad用のランドスケープとiPhone用のポートレートに設定できるかどうかは疑問でしたか?現在、私はinfo.plistファイルにinitial interface orientationを設定していますが、iPadとiPhone用に異なるオプションはないようです。 info.plistファイルで実行できない場合は、プログラムでどのように行うのですか?それはsupported orientation sのinitial interface orientation財産紛争のように見えますiPadとiPhoneの起動方法が異なりますか?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { 

     if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) { 
      return YES; 
     } 

    } 
    else { 

     if (interfaceOrientation == UIInterfaceOrientationPortrait) { 
      return YES; 
     } 
    } 

return NO; 

}

+0

http://stackoverflow.com/a/17628668/468724 –

答えて

1

、プログラムで次のコードを使用して行うことができます。私は解決策を見つけたhere、しかし。

+0

解決策が見つかりました:http://stackoverflow.com/questions/402/iphone-app-in-landscape-mode – tipycalFlow

+0

これは解決策ではありません私が探していたのは、私の友人...問題は起動オリエンテーション(iOSがオリエンテーション通知を開始していないので、 'shouldAutorotateToInterfaceOrientation'が**呼び出されていない**)です。 appdelegateでデバイスの向きを 'NSLog'すると、出力は' orientation unknown'となります!!! – tipycalFlow

0
UIDevice* thisDevice = [UIDevice currentDevice]; 
    if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) 
    { 
     [[UIDevice currentDevice] setOrientation: UIInterfaceOrientationLandscapeRight]; 
    } 
    else 
    { 
     [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait]; 
    } 
+0

'setOrientation'は私のアプリを拒否することができます。とにかくありがとう – tipycalFlow

関連する問題