如何判断 ios设备的类型(iphone,ipod,ipad)



                                                            如何判断 ios设备的类型(iphone,ipod,ipad)



//检测设备

-(bool)checkDevice:(NSString*)name

{
NSString* deviceType = [UIDevice currentDevice].model;
NSLog(@"deviceType = %@", deviceType);

NSRange range = [deviceType rangeOfString:name];
return range.location != NSNotFound;

}



//此处为调用检测函数

NSString *  nsStrIphone=@"iPhone";
NSString *  nsStrIpod=@"iPod";
NSString *  nsStrIpad=@"iPad";
bool  bIsiPhone=false;
bool  bIsiPod=false;
bool  bIsiPad=false;
bIsiPhone=[self  checkDevice:nsStrIphone];
bIsiPod=[self checkDevice:nsStrIpod];
bIsiPad=[self checkDevice:nsStrIpad];

你可能感兴趣的:(如何判断 ios设备的类型(iphone,ipod,ipad))