我知道这可能是一个重复的问题,但我尝试了这里描述的许多答案,但我无法让它从几个小时开始工作。
我正在为IOS 6和IOS 7开发一个应用程序,只是我需要从第一个面向景观的viewController "A“转移到第二个viewController "B”,它是面向肖像的。
我将项目配置为启用所有所需的方向,设置“适当”代码,但仍然将第二个视图垂直显示在景观方向上。

下面是我为第一个控制器设置的代码:
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape ;
}请帮帮忙。
发布于 2014-06-30 08:12:50
如果使用UINavigationViewController方法(pushViewController:animated:和popViewControllerAnimated:),视图将继承前面视图的方向。
另一方面,如果使用presentModalViewController:animated:和dismissModalViewControllerAnimated:方法,一切都会完美地工作。
这里还有一个示例项目,它也在根据您的要求更改方向。
https://stackoverflow.com/questions/24484475
复制相似问题