1

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?

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
Felixs
  • 832
  • 6
  • 11
  • possible duplicate of [Does UI_USER_INTERFACE_IDIOM work with Targeted Device Family](http://stackoverflow.com/questions/3167740/does-ui-user-interface-idiom-work-with-targeted-device-family) – Kristopher Johnson Sep 03 '10 at 17:04
  • Here is my answer: http://stackoverflow.com/questions/12565693/xcode-4-5-ios-6-0-simulator-orientation-not-working/12568678#12568678 – gjpc Sep 24 '12 at 17:50

1 Answers1

-1

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

Community
  • 1
  • 1
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302