Iphone 按ViewController以在横向视图中打开视图
我试图通过按下导航控制器在横向视图中打开视图,但它总是在纵向视图中打开 第一个视图是纵向视图,当我点击按钮时,下一个视图应该是横向视图 我正在尝试下面的代码 调用视图:Iphone 按ViewController以在横向视图中打开视图,iphone,landscape,pushviewcontroller,Iphone,Landscape,Pushviewcontroller,我试图通过按下导航控制器在横向视图中打开视图,但它总是在纵向视图中打开 第一个视图是纵向视图,当我点击按钮时,下一个视图应该是横向视图 我正在尝试下面的代码 调用视图: ResultViewController *resultView = [[ResultViewController alloc] init]; [[self navigationController] pushViewController:resultView animated:YES]; 应在景观中打开的视图: -
ResultViewController *resultView = [[ResultViewController alloc] init];
[[self navigationController] pushViewController:resultView animated:YES];
应在景观中打开的视图:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
这里还有别的东西可以试试吗
谢谢试试
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//return UIInterfaceOrientationIsLandscape(interfaceOrientation);
return ((interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft));
}
然后
- (void)viewDidLoad {
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft animated:YES];
}
在resultView中我也尝试过,但它只会将状态栏更改为横向,而我的resultView仍处于纵向模式。还有什么我可以尝试的吗?你的视图是UIViewController、uitabarcontroller还是UINavigationController?你得到解决方案了吗?如果是,请作为回答发帖否我没有得到答案。相反,我改变了我的应用程序设计。