您的当前位置:首页正文

iOS 使用GCD中的dispatch_apply函数

来源:华拓网

-(void)iteratorWithApply

{

//////////处理数组//////////

NSArray *arrayM = @[@"1",@"2",@"3",@"4"];

//获得全局并发队列

dispatch_queue_t queue = dispatch_get_global_queue(0, 0);

dispatch_apply(arrayM.count, queue, ^(size_t index) {

NSLog(@"%@--%@",arrayM[index],[NSThread currentThread]);

});

}