سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top