我有一个简单的ios导航应用。我的问题是在一个只允许在纵向显示的viewController和一个必须在横向显示的viewController之间导航。
问题是第二个viewController在加载时不会显示在景观中。如果我旋转设备,它会按它应该的方式更新,但我希望因为它只支持横向,所以它应该在转换到视图时首先自动捕捉到横向。有什么想法吗?
谢谢
发布于 2012-08-27 15:16:47
您应该实现shouldAutorotateToFaceInterfaceOrientation:
将此代码放入PortraitviewController.m:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return interfaceOrientation == UIInterfaceOrientationPortrait;
}在LandscapeviewController.m中:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}https://stackoverflow.com/questions/12137116
复制相似问题