我有 2 个带有 dispatch_sync 的块,当第一个块结束时,我为用户显示窗口并开始运行第二个块。但是在第二个区块结束之前,我不会点击屏幕上的任何按钮..
看代码:
[HUD showUIBlockingIndicatorWithText:@"Loading..."];
dispatch_queue_t queue = dispatch_queue_create("myQueue", DISPATCH_QUEUE_CONCURRENT);
dispatch_async(queue, ^ {
dispatch_sync(dispatch_get_main_queue(), ^{
[UIView beginAnimations:@"fade" context:nil];
[UIView setAnimationDuration:0.5];
self.capa.alpha = 0.0;
[UIView commitAnimations];
[HUD hideUIBlockingIndicator];
});
});
dispatch_barrier_async(queue, ^ {
//code executed in the background
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"entrou na foto");
//[self getFotos];
});
});