er.mobileapp
er.mobileapp

Reputation: 1307

Universal application

How to make universal app for iphone and ipad. How we detect the device whether it is for iPhone or iPad?

Upvotes: 2

Views: 1167

Answers (3)

saturngod
saturngod

Reputation: 24949

in Xcode 3

select your target in Xcode, right-click and use the “Upgrade Current Target for iPad…” command.

in Xcode 4

click on the project and go to the target. In Summary tab, change Device to Universal.

I used

UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad

for detecting iPad.

Upvotes: 1

Anh
Anh

Reputation: 6533

The easiest way would be using UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad and UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone.

Upvotes: 2

j_freyre
j_freyre

Reputation: 4738

Personnally, I used this method in my appdelegate

+ (BOOL)isPad
{
    NSLog(@"--------- %@ ---------", [[UIDevice currentDevice] model]);
    NSRange range = [[[UIDevice currentDevice] model] rangeOfString:@"iPad"];
    return !(range.location==NSNotFound);
}

Upvotes: 0

Related Questions