[英]Ipad Simulator not auto rotating
我有一个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
?
我认为您的答案在这里: UI_USER_INTERFACE_IDIOM是否可与目标设备系列一起使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.