API to determine whether running on iPhone or iPad

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2010-05-21T18:00:27Z Indexed on 2010/05/21 18:20 UTC
Read the original article Hit count: 251

Filed under:
|
|
|

Is there an API for checking at runtime whether you are running on an iPhone or an iPad?

One way I can think of would be to use:

[[UIDevice currentDevice] model];

And detect the existence of the string @"iPad" - which seems a bit fragile.

In the 3.2 SDK, I see that UIDevice also has a property which is really what I'm looking for, but doesn't work for pre-3.2 (obviously):

[[UIDevice currentDevice] userInterfaceIdiom]; 

Are there other ways than checking for the existence of @"iPad" for a universal app?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone