我正在使用iPad应用程序,但我仅将其限制在info.plist文件以及“项目”设置中的“横向”(左右)上。这对于iOS 6和7可以正常工作,但是当设备移至纵向(应用程序也移至纵向)时,在iOS 5中无法正常工作。我用谷歌搜索,然后添加了代码。在应用程序委托中:
- (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上搜索了太多,但无济于事。请为此指导我。如何完成这项任务。谢谢。
终于我找到了解决方案。
我正在使用“ SWRevealViewController”第三方库来像iPhone Facebook应用程序那样使用补充工具栏单独的视图,而此类是我项目的起点。我在我的项目RevealView Controller的每个类(它是我的根类)的“ shouldAutorotateToInterfaceOrientation”中设置了Landscape,并为所有类设置了该方向。现在,在这堂课上我也限制了风景,这让我感到宽慰。干杯。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句