使用Dispatch Group追加block到Global Group Queue,這些block如果全部執(zhí)行完畢钳垮,就會執(zhí)行Main Dispatch Queue中的結(jié)束處理的block。
(如根據(jù)若干個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(), ^{// 合并圖片});