2014-03-05 55 views
0

我正在使用iPad应用程序,该应用程序仅限于info.plist文件中的横向(右和左)以及项目设置。这对iOS 6和7工作正常,但当设备移动到肖像(应用程序移动到肖像也)时,iOS 5无法正常工作。我Google搜索,然后添加代码。 in App delegate:无法将应用程序限制在仅适用于iPad 5的横向模式中

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window // iOS 6 autorotation fix 
{ 
return UIInterfaceOrientationMaskLandscape; 
} 

在每个视图控制器中。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
} 

- (NSUInteger)supportedInterfaceOrientations{ 
return UIInterfaceOrientationMaskLandscape; 
} 

但是唉,仍然面临同样的问题。我GOOGLE了太多,但没有任何帮助。请在此引导我。如何完成这项任务。谢谢。

+0

我很高兴你找到了解决方案,但人,iOS5?我试图围绕支持iOS5的商业案例... –

+0

抱歉,迟到的回复,这个问题只是在我处理的iOS 5中,我很好地看到我的答案,并仔细阅读。希望你能得到答案。谢谢。 – josh

+0

哦,我看到它是iOS5。我只是想了解为什么你需要支持iOS5 –

回答

0

最后我找到了解决方案。

我正在使用“SWRevealViewController”边栏的第三方库独立视图像iPhone的Facebook应用程序有,而这个类是我的项目的起点。我在我的项目RevealView控制器中的每个类中设置了“shouldAutorotateToInterfaceOrientation”中的Landscape,这是我的根类,并且在这个类中为所有的方向设置了方向。现在我在限制这个课程的景观后也感到安心。干杯。

相关问题