简体   繁体   中英

Ipad Simulator not auto rotating

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 (interfaceOrientation == 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 ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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