How can we programmatically change the brightness of the iPhone screen?

前端 未结 3 2012
鱼传尺愫
鱼传尺愫 2020-12-06 04:59

How can I change the brightness of the screen programmatically using iPhone SDK?

3条回答
  •  再見小時候
    2020-12-06 05:27

    UPDATE: For Swift 3

    UIScreen.main.brightness = YourBrightnessValue
    

    Here's the swift answer to perform this

    UIScreen.mainScreen().brightness = YourBrightnessValue
    

    YourBrightnessValue is a float between 0.0 and 1.0

提交回复
热议问题