使用Dispatch Group追加block到Global Group Queue,这些block如果全部执行完毕,就会执行Main Dispatch Queue中的结束处理的block。
(如根据若干个url异步加载多张图片,然后在都下载完成后合成一张整图)
dispatch_queue_tqueue =dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0);
dispatch_group_tgroup = dispatch_group_create();
dispatch_group_async(group, queue, ^{/*加载图片1 */});
dispatch_group_async(group, queue, ^{/*加载图片2 */});dispatch_group_async(group, queue, ^{/*加载图片3 */});
dispatch_group_notify(group, dispatch_get_main_queue(), ^{// 合并图片});