我正在实施一个通用应用程序。在我的应用程序中,我需要为iPad而不是为iPhone自动旋转屏幕。我怎样才能做到这一点?我尝试使用以下代码,但它无法正常工作。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}
答案 0 :(得分:0)
最后,我通过更改plist文件中的属性来实现它。
答案 1 :(得分:0)
在努力设置UIViewController的shouldAutorotate
和supportedInterfaceOrientation
方法后,在iOS6中没有成功,我发现最有效的方法是在app delegate中设置它。
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortrait;
}
但是,返回UIInterfaceOrientationMaskPortraitUpsideDown
会导致我的应用崩溃。我不知道我做错了什么!