-1

Possible Duplicate:
Best way to programmatically detect iPad/iPhone hardware

For example I want my view to be portrait only on iPhone and landscape on iPad.

How to detect if I'm running on iphone or iPad in this situation?

Community
  • 1
  • 1
Andre Cytryn
  • 2,506
  • 4
  • 28
  • 43

1 Answers1

5

Write this in your UIViewController:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
        return UIInterfaceOrientationIsPortrait(interfaceOrientation);
    else
        return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
demon9733
  • 1,054
  • 3
  • 13
  • 35