I am developing a Cocoa Touch application for Apple's App sto开发者_运维百科re and I want to do some tweaking in the code depending on what device it's running on. How can I tell?
I've used this in a Universal app to determine if the code is running on an iPad
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// Do iPad only stuff here
}
Check out the documentation for UIDevice
Look at UIDevice
and it's properties. There is a systemVersion
string that will work for what you want.
精彩评论