0
votes

I am familiar with checking if I am on iPad using (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad). But, this is true only for universal apps. I wonder if there is a way to know I am on iPad running an iPhone app.

Thanks!

2

2 Answers

0
votes

You could use [[UIDevice currentDevice] model].

-1
votes

I think even then it gives the right device indication..

As UIDevice uses a shared class through out the device, it should give iPad only what ever type of the app is..

Have you tried it.?

As per the apple, and enum defined in UIDevice class it is like this

typedef NS_ENUM(NSInteger, UIUserInterfaceIdiom) {
#if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED
UIUserInterfaceIdiomPhone,           // iPhone and iPod touch style UI
UIUserInterfaceIdiomPad,             // iPad style UI
#endif
};

Here you can see that it enum just gives the which style of UI it is using, as it is iPhone app running in iPhone style UI it gives as UIUserInterfaceIdiomPhone

And also the name itself says that UserInterfaceIdiom it means it relate to UI screen size.

Instead you can use

[[UIDevice currentDevice] model];

Which gives the exact device model, here you can check for range of string "iPad" to identify the device.