disptch_after 自递归

NSArray *arr = @[@"1", @"2", @"3", @"4", @"5"];
    int time = 1;//间隔时间s
    for (int i = 0; i < arr.count; i++) {
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(i * time * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            //循环里执行的语句
            NSLog(@"%@",arr);
        });
    }
posted @ 2017-08-22 10:09  wzdevelop  阅读(164)  评论(0编辑  收藏  举报