仅限风景的应用程序仍在iOS7中自动镜像到肖像 [英] Landscape-only app still autorotates to portrait in iOS7
本文介绍了仅限风景的应用程序仍在iOS7中自动镜像到肖像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
更新到iOS7后,我的应用程序显示自动旋转。
我希望它是一个仅限景观的应用程序,因此,我按如下方式设置所有内容:
在iOS6中很好。
After updating to iOS7, my app shows autorotation. I want it to be a landscape-only app and, accordingly, I set up everything as follows: In iOS6 was fine.
< img src =https://i.stack.imgur.com/3LyKt.pngalt =在此处输入图像说明>
在.plist文件中:
In .plist file:
在我的 MainWindow
控制器
-(BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
AppDelegate.m
将其称为:
MainViewController* mainViewController = [[MainViewController alloc] init];
// Create the navigation controller
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:mainViewController];
[navController setNavigationBarHidden:NO];
[[self window] setRootViewController:navController];
但是当我旋转设备时,应用程序仍然以纵向模式自动旋转。
在iOS 6中,我没有这样的行为。
But still the app autorotate in portrait mode when I rotate the device. In iOS 6 I had not such behavior.
推荐答案
试试这样,
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return (UIInterfaceOrientationMaskLandscape);
}
这篇关于仅限风景的应用程序仍在iOS7中自动镜像到肖像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文