我正在为 iOs 在 xcode 中编写应用程序。我有这样的代码:
- (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
}
我希望在 cleanScreen 函数删除项目之前,边框颜色和宽度的更改会在屏幕上反映 1 秒钟。但是碰巧这些更改没有反映,并且花了一秒钟的时间将元素删除。
我想在调用 cleanScreen 之前刷新屏幕。
如何达到我想要的效果?
提前致谢!