您的位置:首页 > 移动开发 > IOS开发

如何判断ios设备类型

2012-02-14 09:33 393 查看
功能函数:

[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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: