Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIScreen Brightness Property

At the moment I'm trying to create an application to adjust the device's brightness. In iOS5, there is the new brightness property for mainScreen that allows you to set the screen brightness. I'm using the following code:

[[UIScreen mainScreen] setBrightness:1.0];

However this seems to only work until the device is locked, and doesn't get saved in settings. Is there something I'm doing wrong?

like image 751
ac3xx Avatar asked Oct 26 '11 09:10

ac3xx


1 Answers

You will need to save the value you want to set yourself in your NSUserDefaults and call setBrightness: in your application delegate's applicationDidBecomeActive: method to restore the brightness.

like image 72
DarkDust Avatar answered Oct 26 '22 04:10

DarkDust