我有一个iphone应用程序并且正在使用shouldAutorotateToInterfaceOrientation
来确定何时自动旋转。在iphone上,我指定UIInterfaceOrientationPortrait
是唯一允许的方向;在iPad上,我只返回YES(即所有允许的),如下所示:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) //also tried using [[UIDevice currentDevice] userInterfaceIdiom] to no avail
return YES; //doesn't get here
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
这是在标签栏的每个视图控制器中。当我NSLog()[[UIDevice currentDevice] userInterfaceIdiom]
时,它返回0(或UIUserInterfaceIdiomPhone
)。
iPad模拟器是否始终返回UIUserInterfaceIdiomPhone
?