In loadView, I add myself as an observer for
[nc addObserver:self
selector:@selector(proximityAlert:)
name:UIDeviceProximityStateDidChangeNotification
object:device];
then I tell the device to start generating these alerts
[device setProximityMonitoringEnabled:YES]
and I process them in
-(void)proximityAlert:(NSNotification *)note
The problem is that when I close the sensor for too long, the screen turns off, which is not convenient in my application.
Thanks for all the answers.
source
share