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

功能函数:

[cpp] view plaincopy
-(bool)checkDevice:(NSString*)name  
{  
    NSString* deviceType = [UIDevice currentDevice].model;  
    NSLog(@"deviceType = %@", deviceType);  

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

调用:

[cpp] view plaincopy
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];  

出自:http://blog.csdn.net/tangaowen/article/details/6525992

    原文作者:SQC
    原文地址: https://segmentfault.com/a/1190000000339760
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞