开发中有时我们需要知道当前设备的一些基本信息,比如:是iphone还是ipad,手机型号等信息,苹果给我们提供了UIDevice类,它提供啦与设备相关的一些重要属性,我们可以获知系统的一些详细信息。UIDevice类被设计成一个单例类,方便共享不浪费使用。使用方式:[UIDevice current...
分类:
移动开发 时间:
2015-12-10 13:18:15
阅读次数:
197
在IOS后台执行是本文要介绍的内容,大多数应用程序进入后台状态不久后转入暂停状态。在这种状态下,应用程序不执行任何代码,并有可能在任意时候从内存中删除。应用程序提供特定的服务,用户可以请求后台执行时间,以提供这些服务。判断是否支持多线程UIDevice* device = [UIDevice cur...
分类:
移动开发 时间:
2015-12-09 16:47:15
阅读次数:
187
首先判断是否支持多线程UIDevice *device = [UIDevice currentDevice];BOOL backgroundSupported = NO;if ([device respondsToSelector:@selector(isMultitaskSupported)]) ...
分类:
移动开发 时间:
2015-11-26 01:20:36
阅读次数:
159
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7){ self.navigationController.navigationBar.barTintColor = [UIColor redColor]; } self.na....
分类:
其他好文 时间:
2015-11-24 12:36:36
阅读次数:
205
记录一下 以备以后用到的时候拿出来看看。以前使用的:1 if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone) {2 presentViewController(vc, animated: tru....
分类:
移动开发 时间:
2015-11-20 19:47:02
阅读次数:
203
UIDevice类是一个单例,其唯一的实例( [UIDevice currentDevice] ) 代表了当前使用的设备。通过这个实例,可以获得设备的相关信息(包括系统名称,版本号,设备模式等等)。也可以使用使用该实例来监测设备的特征(比如物理方向)。NSString *strName = [[UI...
分类:
移动开发 时间:
2015-11-20 19:28:45
阅读次数:
149
UIApplication *app = [UIApplication sharedApplication]; // 根据用户版本,获取用户权限 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8) { UIUs...
分类:
其他好文 时间:
2015-11-11 06:19:14
阅读次数:
171
原来iOS8增加了启动授权,需要用户同意下才能注册通知。添加如下代码:- (void)RegistNotificationSettings{ float sysVersion=[[UIDevice currentDevice]systemVersion].floatValue; if (...
分类:
移动开发 时间:
2015-11-09 17:14:18
阅读次数:
273
判断是否是iOS8 //判断是否是iOS8if ([[UIDevice currentDevice].systemVersion doubleValue]>=8.0) {NSLog(@"shi "); }else{NSLog(@"bushi");}
分类:
移动开发 时间:
2015-11-09 15:28:24
阅读次数:
133
在开发中,需要获取当前设备的一些信息,可以通过UIDevice,NSbundle,NSlocale获取.UIDeviceUIDevice 提供了多种属性,类函数及状态通知,可以检测手机电量,定位,感应,机型,当前系统版本等等.//设备相关信息的获取 NSString *strName = [[U.....
分类:
移动开发 时间:
2015-11-09 12:41:40
阅读次数:
295