1

現在のViewControllerで向きが機能していません。UINavigationController のカテゴリも使用しています。supportedInterfaceOrientations メソッドが呼び出されますが、変更はありません。Base viewcontroller shouldAutorotate メソッドは YES を返します。次のコードはどこにありますか。

私はこのコードを使用しています。

ViewControllerOne *viewOne = [[ViewControllerOne alloc]init];

UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:viewOne];
navCtrl.modalPresentationStyle = UIModalPresentationFormSheet;

[self presentViewController:navCtrl animated:YES completion:nil];

私を助けてください。前もって感謝します...

4

1 に答える 1

1

どのシミュレーターiOS5またはiOS6を使用していますか?さらにコードを投稿してください。このリンクも参照してください。

appDelegateのこのラインコードを置き換えました:

[window addSubview:viewController.view];

この行で:

[window setRootViewController:viewController];

iOS5と6の両方を確認してください

if ([self respondsToSelector:@selector(presentViewController:animated:completion:)])
        {
            [self presentViewController:navigationControllerCustom animated:YES completion:nil];
        }
        else
        {
            [self presentModalViewController:navigationControllerCustom animated:YES];
        }

ローテーションに使用してみてください

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

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

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}
于 2012-12-05T09:06:31.130 に答える