How would I program the ability to change brightness in-app? I know that its possible as I have seen at least three apps that can do it. This would be very useful for my app. I know that it’s only possible in iOS 5 with the UIScreen Class, but I have no idea how to program it. Please help me!
Share
The
UIScreenclass has a new property calledbrightness.In addition, there’s another property called
wantsSoftwareDimmingthat (when set toYES) allows you to go below the lowest brightness supported by the hardware, because a special “dimming view” is overlaid over the screen to darken things even further.The
brightnessproperty takes a float from0to1. So:wantsSoftwareDimmingset toNO(the default), abrightnessof0means “the darkest the hardware supports” and abrightnessof1means “the brightest the hardware supports”.wantsSoftwareDimmingset toYES, abrightnessof0means “the darkest the hardware supports PLUS darkening by overlaying a dimming view”, and abrightnessof1still means “the brightest the hardware supports”.