Use the macro UI_USER_INTERFACE_IDIOM() on iOS> = 3.2:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
In earlier versions of iOS, you can return to your code, namely:
NSRange ipadRange = [[[UIDevice currentDevice] model] rangeOfString:@"iPad"]; if(ipadRange.location != NSNotFound) {
This approach is compatible with porting in the sense that if Apple releases another iPad next year, the name of the model may change, but the word "iPad" will certainly be somewhere inside the line.
Jacob Relkin Dec 31 '10 at 2:43 2010-12-31 02:43
source share