Possible Duplicate:
Best way to programmatically detect iPad/iPhone hardware
I am preparing an app where in I want to use it on iPhone as well as iPad.
How to detect whether the current host device is iPhone or iPad?
Based on this I want to make changes to the User Interface
There are so many ways to find in which device the App is running.
[[[UIDevice currentDevice] systemVersion] floatValue];
by using this code we can get current device version, so that we can check whether the device is iPhone of iPad.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// iPad-specific interface here
}
else
{
// iPhone and iPod touch interface here
}
This is the 'official' way to detect the device type at runtime:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// The device is an iPad running iPhone 3.2 or later.
}
else
{
// The device is an iPhone or iPod touch.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With