如果需要获得UIDeviceOrientation的转换消息的话,只需要: [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] ...
分类:
其他好文 时间:
2015-10-07 11:59:24
阅读次数:
175
float?version?=?[[[UIDevice?currentDevice]?systemVersion]?floatValue];
if?(version?>=?8.0)?{
????UIUserNotificationSettings?*settings?=?[UIUserNotificationSettings?settingsForTy...
分类:
移动开发 时间:
2015-09-30 16:37:19
阅读次数:
252
通过UIDevice.currentDevice()来获取设备,可以取得设备当前的方向。同时,我们可以添加一个通知来监听设备方向的变化,这样在开发中可以对不同的方向定制不同的排版布局界面。下面通过一个样例,演示如何监测设备方向:123456789101112131415161718192021222...
分类:
编程语言 时间:
2015-09-28 11:41:03
阅读次数:
191
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) { SEL selector = NSSelectorFromString(@"setOrientation:"); ...
分类:
其他好文 时间:
2015-09-17 23:26:27
阅读次数:
478
指南针图片 IBOutlet UIImageView *compassView 1 #import "ViewController.h" 2 #import 3 4 #define isIOS(version) ([[UIDevice currentDevice].systemVersion f.....
分类:
移动开发 时间:
2015-09-15 17:58:04
阅读次数:
1026
//定位 需要在info中添加NSLocationWhenInUseUsageDescription if ([[UIDevice currentDevice].systemVersion doubleValue]>=8.0) { //获取权限 [self.locat...
分类:
移动开发 时间:
2015-09-15 16:27:42
阅读次数:
209
根据光线感应关闭和开启屏幕UIDevice *_curDevice = [UIDevice currentDevice]; [_curDevice setProximityMonitoringEnabled:YES]; NSNotificationCenter *_defaultCenter =.....
分类:
其他好文 时间:
2015-09-10 19:31:22
阅读次数:
139
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)#define SYSTEM_VERSI...
分类:
移动开发 时间:
2015-09-08 18:21:28
阅读次数:
239
概述sensoriPhone自带很多传感器,常见的如下表所示:系统针对各种sensor都有相应的使用方法,eg: 距离传感器使用// 开启距离感应功能[UIDevice currentDevice].proximityMonitoringEnabled = YES;// 监听距离感应的通知[[NSN...
分类:
其他好文 时间:
2015-09-04 12:24:17
阅读次数:
220
UIDevice类提供了一个单例对象,它代表着设备,通过它可以获得一些设备相关的信息,比如电池电量值(batteryLevel)、电池状态(batteryState)、设备的类型(model,比如iPod、iPhone等)、设备的系统(systemVersion)UIDevice特点:(1)通过[U...
分类:
移动开发 时间:
2015-08-31 21:27:29
阅读次数:
154