防止iPhone入睡 [英] Prevent iPhone to sleep

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

问题描述

我在应用程序中使用了加速度计,并且正在使用[UIApplication sharedApplication].idleTimerDisabled = YES;来防止设备进入睡眠状态.它可以正常工作,但是通过这种方式屏幕始终处于全亮状态,有没有一种方法可以防止设备进入睡眠状态并保持节能模式? 当idleTimerDisabled设置为NO时,设备在睡眠前进入节能模式,我只想防止设备进入睡眠状态并保持节能.有办法吗?

I using accelerometer in my app and i'm using [UIApplication sharedApplication].idleTimerDisabled = YES; to prevent the device to sleep. It works fine, but this way the screen is always on full bright, there is a way to prevent the device to sleep and keep the energy economy mode on? When idleTimerDisabled is stetted to NO the device enter in the energy economy mode before sleep, i just want to prevent the device to sleep and keep the energy economy. There is a way to do that?

推荐答案

有一个UIScreen实例brightness的属性,可能是您想要的.查看UIScreenbrightness属性的文档

There's a property of UIScreen instances, brightness, that is likely what you want. Check out the documentation of UIScreen's brightness property here.

尝试:

[[UIScreen mainScreen] setBrightness: 0.3];

注意::在我发布信息时,DarkXphenomenon发布了指向

NOTE: As I was posting, DarkXphenomenon posted a link to an SO question whose asker gave the exact same solution. DarkXphenomenon is quick on the draw.

这篇关于防止iPhone入睡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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