- (void)ViewDidLoad { // 打开距离传感器,开启距离检测功能 [UIDevice currentDevice].proximityMonitoringEnabled = YES;// 监听距离改变 [[NSNotificationCenter defaultCent...
分类:
其他好文 时间:
2015-11-06 12:35:34
阅读次数:
147
获取手机当前版本号 //获取硬件信息 UIDevice *device=[UIDevice currentDevice]; //输出版本号 NSLog(@"%@",device.systemVersion);获取手机方向1 通知 //检测设备朝向使用UIDevice,beg...
分类:
其他好文 时间:
2015-10-27 13:18:09
阅读次数:
127
下面就一句话就能获取UUID,代码如下 NSString?*clientID=[UIDevice?currentDevice].identifierForVendor.UUIDString;
????NSLog(@"clientID:%@",clientID);//clientID:39967DCE-C08E-483E-9A70-9F16BB9DF...
分类:
其他好文 时间:
2015-10-26 12:20:23
阅读次数:
196
建议写一个全局的宏IOS9的[UIApplicationsharedApplication].keyWindow 建议用代理的+(UIWindow *)getKeyWindow{ if ([[[UIDevice currentDevice] systemVersion] floatValue] >....
分类:
移动开发 时间:
2015-10-23 10:03:03
阅读次数:
345
if ([UIDevice currentDevice].systemVersion.doubleValue > 8.0) { [self.locMgr requestAlwaysAuthorization]; } else { [self.locMgr startUpdatingLo...
分类:
移动开发 时间:
2015-10-21 15:47:10
阅读次数:
140
#pragma mark - 设备型号识别 #define is_IOS_7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) #define iPhone4s ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeE...
分类:
其他好文 时间:
2015-10-20 15:30:47
阅读次数:
226
浮点数不准,这个貌似基本都知道。但是在开发中很多人没有对它的使用产生警觉。如果你在开发iOS应用,你可能使用过如下代码判断系统版本: if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) ...
分类:
其他好文 时间:
2015-10-14 12:52:06
阅读次数:
148
三种常用的办法获取iOS设备的型号:1. [UIDevice currentDevice].model (推荐);2. uname(struct utsname *name) ,使用此函数需要#include;3.sysctlbyname(const char *name, void *oldp, ...
分类:
移动开发 时间:
2015-10-13 20:41:25
阅读次数:
202
//手机序列号 NSString* identifierNumber = [[UIDevice currentDevice] uniqueIdentifier]; NSLog(@"手机序列号: %@",identifierNumber); //手机别名: 用户定义的名称 NS...
分类:
移动开发 时间:
2015-10-13 13:40:51
阅读次数:
140
系统提供的接口[[UIDevice currentDevice] model]只能获取iphone,ipad无法具体到iphone6等,下面这个接口可以获取到具体的,后续有新的系统在增加+ (NSString*)deviceVersion{ // 需要加入#import "sys/utsnam...
分类:
移动开发 时间:
2015-10-09 13:34:23
阅读次数:
144