传感器--------接近传感器
来源:互联网 发布:苗阜水平知乎 编辑:程序博客网 时间:2024/04/30 10:44
#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; //开启距离传感器检测 [UIDevice currentDevice].proximityMonitoringEnabled = true; //添加<span style="font-family: Arial, Helvetica, sans-serif;">距离传感器距离</span><span style="font-family: Arial, Helvetica, sans-serif;">改变的通知</span> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(proximityStateDidChange) name:UIDeviceProximityStateDidChangeNotification object:nil];}- (void)proximityStateDidChange { if ([UIDevice currentDevice].proximityState) { NSLog(@"接近"); //此处写对应功能代码 } else { NSLog(@"远离"); //此处写对应功能代码 }}- (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; }- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end
0 0
- 传感器--------接近传感器
- 读书笔记 --- 接近传感器
- 环形接近传感器超高品质
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 传感器
- 第五周项目2-游戏中的角色类(2)
- ListView的动态刷新问题——用notifyDataSetChanged没作用
- Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:aspectj-maven-plugin:1.3.
- 长方柱
- 【最长递增子序列】 导弹拦截系统
- 传感器--------接近传感器
- Hdu 3336 Count the string(求给定字符串含前缀的数量)
- 修改Android工程的编码,GBK 变UTF-8
- 数据库 设计三大范式
- javascript基础知识(数组)
- [Lintcode] 搜索旋转排序数组 II Search in Rotated Sorted Array II
- How To Install nginx on CentOS 6 with yum
- C++ explicit构造函数
- IP地址判断有效性