在我的应用程序中,我需要处理ViewControllers
的不同方向。
ViewController1
必须只支持横向方向。ViewController2
必须支持横向和纵向方向。
我在 Summury 项目中启用了所有方向,如下图所示:
因此,我在 ViewController1
中插入了以下代码:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
我在 ViewController2
中插入了以下代码:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
问题在于
ViewController1
也会在竖屏方向旋转(它应该只支持横屏方向)。
有什么想法吗?
非常感谢大家!