关闭屏幕 [英] Turning screen off
问题描述
我需要我的应用程序运行,而没有iPhone睡觉。但我想关闭屏幕。
我通过以下方式禁止iPhone进入睡眠:
[[ UIApplication sharedApplication] setIdleTimerDisabled:YES];
但是如何关闭屏幕?
更新:已弃用此方法。请参阅下面的TimothéeBoucher的评论。
您可以通过接近传感器关闭屏幕,
- [UIApplication setProximitySensingEnabled:(BOOL)]
I need my application to be running without the iPhone going to sleep. But I'd like to turn the screen off. Something similar is done in the Phone application, when you speak on the phone.
I prevent the iPhone from going to sleep in the following way: [ [UIApplication sharedApplication] setIdleTimerDisabled: YES];
But how can I turn the screen off? And how do I turn it back, when user touched the screen?
Thanks.
Update: This method has been deprecated. See the comment by Timothée Boucher below.
You can turn the screen off via the proximity sensor, but there is no other public way to put the screen to sleep.
-[UIApplication setProximitySensingEnabled:(BOOL)]
这篇关于关闭屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!