0

起動画面の直後の表示は、デバイスの向きで提示する必要がありますが、表示されたら他の向きに自動回転しないでください。私はこのコードを使用:iPhoneで自動回転しないですべての向きをサポートする

- (BOOL)shouldAutorotate { 

    [super shouldAutorotate]; 

    return YES; 
} 

-(UIInterfaceOrientationMask) supportedInterfaceOrientations { 

    [super supportedInterfaceOrientations]; 

    return UIInterfaceOrientationMaskAll; 
} 

これが唯一の肖像画でshouldAutorotate結果の設定NO、iPadのためではなく、iPhoneに適しています。これは正常な動作ですか?もしそうならば、iPhoneでオートローテーションなしでどのようにすべての向きをサポートできますか?特定のView Controllerのみ?

答えて

0

あなたは起動時にデバイスがであるものの向きを検出する必要があります。

UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; 

インターフェイスの方向にそれを変換します

switch (orientation) { 
    case UIDeviceOrientationLandscapeRight: 
     return UIInterfaceOrientationLandscapeLeft; 
    default: 
     return UIInterfaceOrientationLandscapeRight; 
} 

今どこグローバルアクセスのためにそれを格納していることを返します:

- (UIInterfaceOrientationMask) supportedInterfaceOrientations { 
    return globalOrientation; 
} 
関連する問題