关闭屏幕 [英] Turning screen off

查看:113
本文介绍了关闭屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要我的应用程序运行,而没有iPhone睡觉。但我想关闭屏幕。



我通过以下方式禁止iPhone进入睡眠:
[[ UIApplication sharedApplication] setIdleTimerDisabled:YES];



但是如何关闭屏幕?

解决方案

/ div>

更新:已弃用此方法。请参阅下面的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆