Ipad模拟器不能自动旋转

时间:2010-09-03 17:00:31

标签: iphone cocoa-touch ipad orientation ios-simulator

我有一个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

1 个答案:

答案 0 :(得分:-1)