what is the code to detect whether ios app running in iPhone, iPhone Retina display, or iPad?
Background:
for my iPhone application I have defined i
You can use [[UIDevice currentDevice] userInterfaceIdiom]
to determine whether you're running on an iPhone/iPod touch or an iPad.
There's often no need to determine directly whether you're on a retina display because UIImage
handles that automatically when you use imageNamed
and append "@2x" to your high resolution image file names (see Supporting High-Resolution Screens in the Drawing and Printing Guide for iOS).
If you really need to know which resolution the screen has, use UIScreen
's scale
method.