Works On Mine
Works On Mine

Reputation: 1121

Animate UIScreen brightness

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?

Upvotes: 0

Views: 349

Answers (0)

Related Questions