简体   繁体   中英

Turning off the iPhone screen

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM