我正在研究iPad应用程序,我只限制在info.plist文件中的Landscape(右和左)以及项目设置。这适用于iOS 6和7,但是当设备移动到纵向时,这在iOS 5中工作不正常(app也移动到肖像)。我用谷歌搜索,然后添加代码。 在App委托:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window // iOS 6 autorotation fix
{
return UIInterfaceOrientationMaskLandscape;
}
在每个View控制器中。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
但是,唉,仍然面临同样的问题。我用Google搜索过多但没有任何帮助。请指导我这个。如何完成这项任务。感谢。
答案 0 :(得分:0)
最后我找到了解决方案。
我正在使用“SWRevealViewController”侧边栏独立视图的第三方库,就像iPhone Facebook应用程序一样,这个类是我项目的起点。我在项目RevealView Controller(我的根类)中的每个类上设置了“shouldAutorotateToInterfaceOrientation”中的Landscape,并且在此类方向中为所有类设置了方向。现在,在限制了这堂课的景观之后,我感到宽慰。欢呼声。