Adjust the brightness of the screen through code

ε祈祈猫儿з 提交于 2019-12-03 07:04:35

You can use:

[[UIScreen mainScreen] setBrightness:1.0];

But only on iOS 5. Not supported on earlier iOS versions.

If you require compatibility with older iOS versions, try a black overlay on top of your application's main window with partial alpha. I used it in an iPad app - only downside is that it won't darken elements like popovers.

Check out the brightness property of UIScreen. This is a new API in iOS 5. You can't do it in older versions.

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