【发布时间】:2022-06-22 11:12:15
【问题描述】:
我有一个需要距离检测的功能,但我发现了一个令人困惑的问题。每当有东西接近超过 1 秒时,它就会变黑。可以在启动距离检测的前提下停止黑屏吗
[UIDevice currentDevice].proximityMonitoringEnabled=YES;[[NSNotificationCenter
defaultCenter] addObserver:self selector:@selector(proximityStateDidChange:) name:UIDeviceProximityStateDidChangeNotification object:nil];
- (void)proximityStateDidChange:(NSNotification *)note
{
if ([UIDevice currentDevice].proximityState) {
NSLog(@"...");
} else {
NSLog(@"...");
}
}
【问题讨论】:
标签: ios objective-c