问题描述
我有一个iOS 7应用程序,我想让屏幕更暗。我正在使用以下行调整屏幕亮度:
I have an iOS 7 app where I want to make the screen darker. I am adjusting the screen brightness using the following line:
[UIScreen mainScreen].brightness = 0.3;
这会像我预期的那样使屏幕变暗,但如果用户启用了自动亮度,屏幕有时会返回到原来的设置。有没有办法在我的应用程序中禁用自动亮度,或者我是否需要订阅UIScreenBrightnessDidChangeNotification通知并在每次引发时重置亮度?
This dims the screen as I expect, but if a user has auto brightness enabled the screen sometimes goes back to its original setting. Is there a way to disable auto brightness while in my app, or do I need to subscribe to the UIScreenBrightnessDidChangeNotification notification and just reset the brightness each time it is raised?
推荐答案
您根本无法禁用自动亮度,因此您必须订阅通知。阅读有关UIScreen中可用方法的更多信息:
You cannot disable the auto brightness at all, so you will have to subscribe to the notification. Read more about available methods in UIScreen:
这篇关于iOS 7自动亮度正在推翻应用程序屏幕亮度设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!