Question

What I would like to do is simply make the iDevice fade the screen to black one the proximityState returns yes. However, I am not sure of how to enable it, or monitor it. Would someone be able to simply provide syntax of enabling and monitoring proximityState? The help would be highly appreciated for a new programmer like me.

Thanks! -Jake

Was it helpful?

Solution

You need to use the [UIDevice currentDevice] singleton. First set proximityMonitoringEnabled to YES. Then, you can access the proximity information through the proximityState property. Subscribe to changes to the proximity state by observing the UIDeviceProximityStateDidChangeNotification notification.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top