pushViewController在横向中打开视图

时间:2010-10-14 20:29:16

标签: iphone landscape pushviewcontroller

我试图通过推动导航控制器打开景观视图但它总是以纵向打开。

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

我正在尝试关注代码

调用视图:

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

应该以横向打开的视图:

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

还有什么可以尝试的吗?

由于

1 个答案:

答案 0 :(得分:0)

尝试..

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

然后......

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

}

中的