Search code examples
iosscreenbrightness

How to call the UI for screen brightness


I use this code to change the iPhone screen brightness:

- (void)setLightValue:(CGFloat)lightValue
{
    [UIScreen mainScreen].brightness = lightValue ;
}

However this code doesn't call the brightness UI of the iPhone screen.

I want something like this to appear on brightness change: Please refer to the following picture


Solution

  • Have you tested [[UIScreen mainScreen] setBrightness:0.1]; for values from 0.0 to 1.0 over a noticeable time span? Does the brightness change? Do you get the UI?