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 and proximityState.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top