Is there any way to change the background color of a window immediately?
I need a blinking background, i.e. red/green blinking in an interval of a second. As i see, the background color will not change immediately, but only when function is left.
Is there any way to force the system to change it and redraw the window's background immediately?
- (void)viewDidLoad
{
[super viewDidLoad];
flag = YES;
NSTimer *mTimer = [NSTimer scheduledTimerWithTimeInterval:.5
target:self
selector:@selector(changeColor)
userInfo:nil
repeats:YES];
}
- (void)changeColor
{
if (flag == YES)
{
self.view.backgroundColor = [UIColor redColor];
flag = NO;
return;
}
self.view.backgroundColor = [UIColor blueColor];
flag = YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With