Is this the proper way to detect an iPad?
Use the UI_USER_INTERFACE_IDIOM()
macro on iOS >= 3.2:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { //device is an iPad.}
On earlier versions of iOS, you can fall back to your code, namely this:
NSRange ipadRange = [[[UIDevice currentDevice] model] rangeOfString:@"iPad"];if(ipadRange.location != NSNotFound) { //Do iPad stuff.}
This approach is forward-compatible in the sense that if next year Apple released a different iPad, the model name might change, but the word "iPad" will definitely be somewhere inside the string.
Nope. Do this instead:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { // ...}