0

私のアプリケーションの大部分は回転をサポートしていません。サポートされている向きでは、ポートレートのみが選択されています。アプリケーションが使用する UIViewController サブクラスには、次のものがあります。

-(BOOL)shouldAutorotate {
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations {
    NSLog(@"supported?");
    return UIInterfaceOrientationMaskPortrait;
}

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

    NSLog(@"preferred");
    return UIInterfaceOrientationPortrait;
}

向きをサポートする UIViewController サブクラスには、次のものがあります。

-(BOOL)shouldAutorotate {
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations {
    NSLog(@"supported?");
    return UIInterfaceOrientationMaskAll;
}

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

    NSLog(@"preferred");
    return UIInterfaceOrientationPortrait;
}

ただし、私のアプリケーションは、これを含むどのビューでも回転しません。ここで思い通りに回転させるにはどうすればよいですか?

4

1 に答える 1

1

ナビゲーション コントローラーを使用している場合は、App Delegate でこれを行うようにしてください。

self.window.rootViewController = self.navigationController;

追加の参照については、SO からのこの質問を確認してください。

iOS6 で回転の動作が異なる

于 2012-10-03T17:59:34.220 に答える