美文网首页
iOS进阶之GCD-dispatch_after

iOS进阶之GCD-dispatch_after

作者: 天蓬大元 | 来源:发表于2019-03-19 17:40 被阅读0次

一:dispatch_after

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)    (<#delayInSeconds#> * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

    <#code to be executed after a specified delay#>

  });

二:NSObject中提供的线程延迟方法

[self performSelector:@selector(run) withObject:nil afterDelay:2.0];

三:通过NSTimer来延迟线程执行

[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(run) userInfo:nil repeats:NO];

相关文章

网友评论

      本文标题:iOS进阶之GCD-dispatch_after

      本文链接:https://www.haomeiwen.com/subject/lkunmqtx.html