Turn off display in iPhone OS (iOS)

nitsky picture nitsky · Oct 16, 2010 · Viewed 22.6k times · Source

is there a way to programmatically turn off the display in iOS? Not just turning brightness down, but off like the way the Phone App does. I am happy to use private API, since this is for personal use.

Thanks!

Answer

iMathieuB picture iMathieuB · Oct 15, 2012

You can turn off the display by enabling the proximity monitoring. It will automatically turn off the screen, like in the Phone app, by placing the phone near your ears or by placing a finger over the IR sensor at the top of the phone.

[UIDevice currentDevice].proximityMonitoringEnabled = YES;