开发者

pushViewController to open a view in landscape

I am trying to open a view in landscape by pushing on navigation controller but it always open in portrait.

First view is in portrait and when I click on a button then next view should be in landscape.

I am trying following code

Calling View:

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

View that should open in landscape:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return (interfaceOrientat开发者_如何转开发ion == UIInterfaceOrientationLandscapeLeft);
}

Is there something else to try here?

Thanks


Try..

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

and then...

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

}

in resultView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜