简体   繁体   English

如何在iOS中更改空闲计时器延迟时间

[英]How to change idle timer delay time in iOS

Is there any way to change time after which idle timer will dim the sceen? 有没有办法改变时间,之后空闲计时器将调暗? I would like to set it in my app, for instance to 5 seconds of no user interaction. 我想在我的应用程序中设置它,例如5秒没有用户交互。

The "idle timer" which invokes the lock screen is not configurable from within the application. 调用锁定屏幕的“空闲计时器”不能从应用程序内配置。 It is the users' discretion how much time to set for the lock screen to kick in. You can probably acquire some hacks to invoke that using private APIs but Apple wouldn't like that. 用户可自行决定为锁定屏幕设置多少时间。您可能会使用私有API获取一些黑客来调用它,但Apple不会那样。

There are ways to disable idle timer of course: 当然有办法禁用空闲计时器:

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];

Note 注意


Important: You should set this property only if necessary and should be sure to reset it to NO when the need no longer exists. 重要提示:您应该仅在必要时设置此属性,并且当需要不再存在时,应确保将其重置为NO。 Most apps should let the system turn off the screen when the idle timer elapses. 当空闲计时器过去时,大多数应用程序应让系统关闭屏幕。 This includes audio apps. 这包括音频应用。 With appropriate use of Audio Session Services, playback and recording proceed uninterrupted when the screen turns off. 通过适当使用音频会话服务,当屏幕关闭时,播放和录制不会中断。 The only apps that should disable the idle timer are mapping apps, games, or similar programs with sporadic user interaction. 应该禁用空闲计时器的唯一应用程序是通过零星的用户交互来映射应用程序,游戏或类似程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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