[[NSRunLoopmainRunLoop] runUntilDate:[NSDatedateWithTimeIntervalSinceNow:0.5]];
例:
_cleaningOrScaningLabel.text = @"正在清理中...";
percentNumber--;
_cleanTipSizeLabel.text = [NSString stringWithFormat:@"%d",percentNumber];
[self refrushCleanTipBjViewFrame];
if (percentNumber == 0) {
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]];
}
本文介绍了一个使用 NSRunLoop 的简易示例来实现一个简单的定时任务功能。通过设置运行循环的持续时间,可以在指定的时间间隔内执行特定操作。

被折叠的 条评论
为什么被折叠?



