如何判断 ios设备的类型(iphone,ipod,ipad)
2015-03-16 15:04
811 查看
实现函数:
-(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];
-(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)
- 如何判断 ios设备的类型(iphone,ipod,ipad)
- 如何判断 ios设备的类型(iphone,ipod,ipad)
- 如何判断 ios设备的类型(iphone,ipod,ipad)
- 如何判断 ios设备的类型(iphone,ipod,ipad)
- 如何判断 ios设备的类型(iphone,ipod,ipad)
- 在Cocoa里用objective-c判断设备类型:iPhone, iPod Touch, iPad
- 在Cocoa里用objective-c判断设备类型:iPhone, iPod Touch, iPad
- 怎样推断 ios设备的类型(iphone,ipod,ipad)
- 在Cocoa里用objective-c判断设备类型:iPhone, iPod Touch, iPad
- 如何判断ios设备类型
- 判断设备类型是iPhone还是iPad
- 如何在程序中判断硬件的机型(是ipad还是iphone/ipod touch)
- 检测iPhone/iPod Touch/iPad设备类型
- ios 区分iphone ipod & ipad的方法及获取设备名称。
- 如何将音视频发布到移动设备,android,ios,iphone,ipad等
- iOS开发 - Xcode如何更换iPhone或iPad模拟器的类型
- 检测iPhone/iPod Touch/iPad设备类型 .
- 如何将音视频发布到移动设备,android,ios,iphone,ipad等