开发者

Ipad Simulator not auto rotating

开发者 https://www.devze.com 2023-01-14 03:49 出处:网络
I have an an iphone app and am using shouldAutorotateToInterfaceOrientation to determine when to autorotate. On the iphone, I specify that UIInterfaceOrientationPortrait is the only allowed orientatio

I have an an iphone app and am using shouldAutorotateToInterfaceOrientation to determine when to autorotate. On the iphone, I specify that UIInterfaceOrientationPortrait is the only allowed orientation; On the iPad, I just return YES (ie all allowed), like so:

- (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 (interfaceOri开发者_如何学编程entation == UIInterfaceOrientationPortrait);
}

This is in every view controller of the tab bar. When I NSLog() the [[UIDevice currentDevice] userInterfaceIdiom], it returns 0 (or UIUserInterfaceIdiomPhone).

Does the iPad simulator always return UIUserInterfaceIdiomPhone?


I think your answer is here: Does UI_USER_INTERFACE_IDIOM work with Targeted Device Family

0

精彩评论

暂无评论...
验证码 换一张
取 消