[英]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.