0

我试图通过推动导航控制器以横向打开视图,但它始终以纵向打开。

第一个视图是纵向的,当我单击一个按钮时,下一个视图应该是横向的。

我正在尝试以下代码

调用视图:

ResultViewController *resultView = [[ResultViewController alloc] init];
    [[self navigationController] pushViewController:resultView animated:YES];

应以横向打开的视图:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

这里还有什么可以尝试的吗?

谢谢

4

1 回答 1

0

尝试..

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    //return UIInterfaceOrientationIsLandscape(interfaceOrientation);
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft));
}

接着...

- (void)viewDidLoad {
    [[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft animated:YES];

}

在结果视图中

于 2010-10-14T21:31:54.687 回答