```//延时方法1
[self performSelector:@selector(task) withObject:nil afterDelay:1];
//延时方法2
NSTimer *timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(task1) userInfo:nil repeats:false];
//延时方法4
[NSThread sleepForTimeInterval:1.0];
//延时方法4
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.0), dispatch_get_main_queue(), ^{
NSLog(@"延时方法4");
});
OC中四种延时方法
最新推荐文章于 2024-06-06 20:24:20 发布