可在最后执行的一个操作里进行界面刷新
dispatch_group_t group = dispatch_group_create();
/*
dispatch_group_enter:通知group,下面的任务马上要放到group中执行了。
dispatch_group_leave:通知group,任务完成了,该任务要从group中移除了。
*/
//轮播图
dispatch_group_enter(group);
[self sendADCycleImageRequestFinished:^(BOOL isFinished) {
dispatch_group_leave(group);
}];
//热门样板间
dispatch_group_enter(group);
[self sendHotHouseTypeRequestFinished:^(BOOL isFinished) {
dispatch_group_leave(group);
}];
//热卖商品
dispatch_group_enter(group);
[self sendHotGoodsRequestFinished:^(BOOL isFinished) {
dispatch_group_leave(group);
}];
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
[self.refresh mk_endRefreshing];
[self.collectionView reloadData];
});
网友评论