Ios6 如何禁用iPhone应用程序的自动旋转?
我正在实现一个通用应用程序。在我的应用程序中,我只需要为iPad而不是iPhone自动旋转屏幕。我该怎么做?我尝试了以下代码,但它不起作用Ios6 如何禁用iPhone应用程序的自动旋转?,ios6,autorotate,Ios6,Autorotate,我正在实现一个通用应用程序。在我的应用程序中,我只需要为iPad而不是iPhone自动旋转屏幕。我该怎么做?我尝试了以下代码,但它不起作用 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return NO; } 最后,我通过更改plist文件中的属性实现了这一点。在努力设置UIViewController的shouldAutorotate和sup
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}
最后,我通过更改plist文件中的属性实现了这一点。在努力设置UIViewController的
shouldAutorotate
和supportedInterfaceOrientation
方法后,我发现最有效的方法是在应用程序委托中设置它
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortrait;
}
但是,返回UIInterfaceOrientationMaskPortraitUpsideDown
会使我的应用程序崩溃。我不知道我做错了什么