How to set different orientation to iPhone and iPad

Go To StackoverFlow.com

-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?

2012-04-04 18:09
by André Cytryn


5

Write this in your UIViewController:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
        return UIInterfaceOrientationIsPortrait(interfaceOrientation);
    else
        return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
2012-04-04 18:15
by demon9733
Hmmm I've seen this userInterfaceIdiom before. Just never thought it would be like this. Awesome, thank - André Cytryn 2012-04-04 18:27
Ads