2012-02-21 10 views
0

私はスプラッシュ画面とホーム画面がある1つのアプリケーションに取り組んでいます。私のアプリケーションは、風景とポートレートモードのアプリケーションです。 私のアプリケーションが起動し、私が風景モードになっているとき、私のホームスクリーンはポートレートモードをいくつかのミリ秒間表示し、その後は風景モードになります。私はそれが風景モードで直接表示する必要があります。Iphoneの風景とポートレートの問題

おかげ

+0

いくつかのコードを投稿できますか? – CarlJ

+0

同様の問題があり、これで解決しました:http://stackoverflow.com/a/10146270/894671 –

答えて

0

は、私は通常の通知を有効にします。私のコントローラで

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 

を私は入れ:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{  
    [self configureOrientation:toInterfaceOrientation]; 
} 

- (void)configureOrientation:(UIInterfaceOrientation)orientation 
{ 

    if(UIDeviceOrientationIsValidInterfaceOrientation(orientation)){ 

     if(UIInterfaceOrientationIsLandscape(orientation)){ 
      [self configureLandscapelView]; 
     }else if(UIInterfaceOrientationIsPortrait(orientation)){ 
      [self configurePortraitlView]; 
     } 
    } 
} 

またのUIViewController自体からの向きを取得することができます。

UIInterfaceOrientation orientation = [self interfaceOrientation]; 

またはステータスバーから:

[UIApplication sharedApplication] statusBarOrientation] 
関連する問題