(不用通知)想要实现一个设备近身的方法,在ViewController.m
中加入如下方法:
-(void)isProximited{
UIDevice *device = [UIDevice currentDevice];
[device setProximityMonitoringEnabled:YES];
if(device.proximityState){
self.view.backgroundColor = [UIColor blueColor];
}
}
结果没能实现isProximited方法,是为什么呢?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
需要使用通知来处理