我有一个以 aUIViewController
作为根视图控制器的应用程序(不是 aTabBar
或NavigationController
应用程序!)。这个应用程序是通用的。iPhone 应该始终是纵向的,iPad 应该始终是横向的。
我尝试了以下方法,但我认为这是 iOS 5 代码,因为它没有在 iOS 6 中调用:
- (BOOL)shouldAutorotate
{
return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
else
{
return (interfaceOrientation == (UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight));
}
}
任何帮助表示赞赏!