GCD定时器---操作

执行间隔秒数
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
 //执行事件
});


    dispatch_async(dispatch_get_main_queue(), ^{
        //事件
    });

你可能感兴趣的:(GCD定时器---操作)