【发布时间】:2011-04-07 23:09:29
【问题描述】:
我有一个 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?
【问题讨论】:
标签: iphone cocoa-touch ipad orientation ios-simulator