0

I was trying to animate the brightness of UIScreen using,

[UIScreen mainscreen].brightness = 0.5

I looked around for ways to do it and found this thread very helpful. However, before looking at the answers in the thread, I tried updating the brightness in a while loop. Something like,

while (originalBrightness > 0.5) {
    originalBrightness -= 0.001;
    [UIScreen mainScreen].brightness = originalBrightness;
}

I have tried placing the above while loop in the AppDelegate and a viewcontroller and it "works" fine either way. We can see a general transition in the brightness of the screen. I was expecting it to be an instant drop in the brightness. Any suggestions on why this would be happening?

Works On Mine
  • 1,111
  • 1
  • 8
  • 20
  • 1
    Because that's how the hardware works? The brightness is on a dimmer. – matt Nov 20 '17 at 22:47
  • @matt If the brightness is on a dimmer, are there any performace trade offs between changing the brightness in a while loop vs using NStimer? – Works On Mine Nov 21 '17 at 00:30

0 Answers0