本文介绍了昏暗的iPhone屏幕,但不要让它睡觉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是用于控制屏幕亮度的Apple Doc。以下是原始问题。

That's the Apple Doc for controlling screen brightness. Below is the original question.

我通过使用Google发现我可以禁用iPhone在应用程序中睡觉使用:

I have found by using Google that I can disable the iPhone going to sleep in an application by using:

application.idleTimerDisabled = YES;

因此代码如下所示:

- (void)applicationDidFinishLaunching:(UIApplication *)application {

    // Override point for customization after application launch

    // This disables the autosleep  I added this to TEST,
    // delete later if you want:-
    application.idleTimerDisabled = YES;
    [window addSubview:switchViewController.view];
    [window makeKeyAndVisible];

完美,效果很好。但是,我的问题是,我可以以某种方式禁止iPhone进入睡眠状态,同时仍然允许屏幕变暗吗?或者也许在应用程序中自己调暗以节省电池电量?

Perfect, it works well. However, my question is, can I somehow disable the iPhone from going to sleep, while still allowing the screen to dim? Or perhaps dim the screen myself in the app as to save battery power?

我绝对不希望iPhone睡觉,但我也希望用户友好/电池友好和昏暗的屏幕。 (你知道,比如你可以设置iPhone在它进入睡眠状态前X秒将屏幕调暗。)有没有一种有效的方法可以做到这一点?

I definitely don't want the iPhone sleeping, but I'd also like to be user friendly/battery friendly and dim the screen. (You know, like how you can set the iPhone to dim the screen X seconds before it goes to sleep.) Is there an effective way to do this?

推荐答案

我很确定官方SDK中没有任何内容。

I'm pretty sure there's nothing in the official SDK.

[(id)[UIApplication sharedApplication] setBacklightLevel:0.3f]; // or whatever value

有效,但当然没有文件记录。最近使用UIGetScreenImage的经验表明,使用有用但未记录的API的正确策略可能是使用它们并查看会发生什么。

works, but is of course undocumented. The recent experience with UIGetScreenImage indicates that perhaps the right strategy with useful but undocumented APIs is to use them and see what happens.

如果没有,有人曾测量过手机是否有用如果显示黑色图像,功耗会下降,或者除非您可以关闭背光,否则功耗会降低?

Failing that, has anybody ever measured if the phone's power consumption goes down if it's showing a black image, or does it not help unless you can turn down the backlight?

这篇关于昏暗的iPhone屏幕,但不要让它睡觉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 20:45