I am programming a application in xcode, for iOs. I have a code like this:
- (void)buttonAction:(UIButton*)sender{
UIView *figure = (UIView *) [figures objectAtIndex:sender.tag];
[figure.layer setBorderWidth:2.0f];
[figure.layer setBorderColor: [UIColor greenColor].CGColor];
sleep(1);
[self cleanScreen];
}
- (void) cleanScreen {
//Some code to hide all view objects
}
I hope that changes the border color and width are reflected on the screen for 1 second before the items are deleted by cleanScreen function. But it happens that these changes are not reflected and spent one second elements are deleted.
I want refresh screen before cleanScreen is called.
How to get the effect I want?
Thanks in advance!
instead of:
use:
with
sleep()you are freezing the whole application