Adjust the brightness of the screen through code

Sid picture Sid · Oct 25, 2011 · Viewed 7.2k times · Source

I am developing an iPhone application and I need to adjust the brightness of the screen through my application, in the same way as we do through the Settings app.

I have searched but have not found a solution.

Answer

NJones picture NJones · Oct 25, 2011

You can use:

[[UIScreen mainScreen] setBrightness:1.0];

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