iOS 7 auto brightness is overruling apps screen brightness setting

徘徊边缘 提交于 2019-12-07 10:10:45

问题


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;

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?


回答1:


You cannot disable the auto brightness at all, so you will have to subscribe to the notification. Read more about available methods in UIScreen:

  • https://developer.apple.com/library/ios/documentation/uikit/reference/UIScreen_Class/Reference/UIScreen.html#//apple_ref/occ/instp/UIScreen/brightness

  • How to turn off Auto-Brightness programatically?

  • Does iOS send notifications when the system changes the screen brightness?


来源:https://stackoverflow.com/questions/22738277/ios-7-auto-brightness-is-overruling-apps-screen-brightness-setting

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!