iOS进阶之GCD-dispatch_after

一: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)