ios iPhone 显示屏灯未自动关闭
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12385691/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iPhone display screen lights not turning off automatically
提问by Firdous
I have observed that my I run my iPhone application (native) the display lights are not turning off as they usually do in other applications, I have waited for couple of minutes but it wont turn off until I exit my application. Is there anything which I had messed up with that is not causing the automatic dimming?
我观察到我运行我的 iPhone 应用程序(本机)时,显示屏灯没有像在其他应用程序中那样关闭,我已经等了几分钟,但在我退出应用程序之前它不会关闭。有什么我搞砸的东西不会导致自动变暗吗?
回答by Kaan Dedeoglu
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
Are the two lines to enable/disable the dimming of the screen in an iOS app. Double check and see if your app has any of these.
是在 iOS 应用程序中启用/禁用屏幕变暗的两行。仔细检查,看看你的应用程序是否有这些。
Put this code into application didFinishLaunchingWithOptions: method.
将此代码放入应用程序 didFinishLaunchingWithOptions: 方法中。
回答by Webdevotion
Have you used this in your app?[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
你在你的应用程序中使用过这个吗?[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
If so, remove it or set it to NO
.
如果是这样,请将其删除或将其设置为NO
。