Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

userInterfaceIdiom always indicate iPhone

Tags:

ios

I added the following code to AppDelegate:

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
    NSLog(@"iPhone found");
} else {
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
    NSLog(@"iPad found");
}

The userInterfaceIdiom always equal to UIUserInterfaceIdiomPhone when running on iPad 2. My iPad 2 is running on iOS 6.1.3.

I cannot find out what the problem is.

Any help is appreciated!

Thanks in advance!

like image 857
aobs Avatar asked Mar 24 '26 08:03

aobs


1 Answers

Targeted Devices should be Universal,

enter image description here

like image 185
Thilina Chamath Hewagama Avatar answered Mar 26 '26 13:03

Thilina Chamath Hewagama



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!