The only way I could find to programmatically turn off (not just dim) the iPhone's screen was by utilizing the UIDevice
property proximityMonitoringEnabled
, which will automatically turn off the screen if the infrared sensor detects proximity to an object while enabled.
Any other (public API only) methods for this? Any way to achieve a reverse-proximity effect (the screen dims when not proximal)?
I am inclined to say no. Not by using a Public API. I believe that the only way to do this would be to use your method
proximityMonitoringEnabled
.There was a way to use a Private API in iOS 5, but it appears that it does not work for iOS 6. (this answer covers iOS 5).
Your best bet is to use the
proximityMonitoringEnable
andproximityState
.