如何保持用户的iPhone显示屏? [英] How do I keep the user's iPhone's display on?
问题描述
所以,我正在寻找一种方法来保持用户的iPhone显示时钟应用程序。我发现 [UIApplication sharedApplication] .idleTimerDisabled = YES;
但是这样可以防止设备一直锁定。当应用程序进入后台时,我尝试 [UIApplication sharedApplication] .idleTimerDisabled = NO;
,但这不起作用。我怎样才能安全地保存在用户的设备从睡眠的我的应用程序运行时的?
改变每当您的应用更改其活动状态时, idleTimerDisabled
属性 - 如果您要进行后台运行,重新启用计时器,并且当您重新获得控制权时,请再次禁用计时器。 / p>
So, I was looking for a way to keep the user's iPhone display on for a clock app. I found [UIApplication sharedApplication].idleTimerDisabled = YES;
but that keeps the device from locking all of the time. I tried to [UIApplication sharedApplication].idleTimerDisabled = NO;
when the application goes into the background, but that doesn't work. How can I safely keep the user's device from sleeping while my app is running?
Alter the idleTimerDisabled
property whenever your app changes its active state - if you're going to be backgrounded, re-enable the timer, and when you regain control, disable the timer again.
这篇关于如何保持用户的iPhone显示屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!