简体   繁体   English

Ipad Simulator无法自动旋转

[英]Ipad Simulator not auto rotating

I have an an iphone app and am using shouldAutorotateToInterfaceOrientation to determine when to autorotate. 我有一个iPhone应用程序,正在使用shouldAutorotateToInterfaceOrientation确定何时自动旋转。 On the iphone, I specify that UIInterfaceOrientationPortrait is the only allowed orientation; 在iphone上,我指定UIInterfaceOrientationPortrait是唯一允许的方向。 On the iPad, I just return YES (ie all allowed), like so: 在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);
}

This is in every view controller of the tab bar. 这在选项卡栏的每个视图控制器中。 When I NSLog() the [[UIDevice currentDevice] userInterfaceIdiom] , it returns 0 (or UIUserInterfaceIdiomPhone ). 当我通过NSLog() [[UIDevice currentDevice] userInterfaceIdiom] ,它返回0(或UIUserInterfaceIdiomPhone )。

Does the iPad simulator always return UIUserInterfaceIdiomPhone ? iPad模拟器是否总是返回UIUserInterfaceIdiomPhone

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM