I'm trying to create an UIView and change its alpha property to simulate backlight change. Here is my code
TransparentView = [[UIView alloc] initWithFrame:self.view.bounds];
TransparentView.backgroundColor = [UIColor whiteColor];
self.view = TransparentView;
TransparentView.alpha = 0.2;
float step = 1.0 / ( appDelegate.OnOffTime * 100);
for (float f = 0; f < 1; f=f+step) {
TransparentView.alpha = (CGFloat)(1 - f);
[NSThread sleepForTimeInterval:0.01];
}
Both TransparentView.alpha = 0.2
and TransparentView.alpha = (CGFloat)(1 - f)
do change TransparentView.alpha
, but only TransparentView.alpha = 0.2
changes real device "brightness'.
What am I doing wrong?