有没有办法手动阻止队列任务?我想在调度队列任务中使用 UIView 动画,但是这个任务应该只有在动画完成后才能完成。
dispatch_queue_t myCustomQueue;
myCustomQueue = dispatch_queue_create("com.example.MyCustomQueue", NULL);
dispatch_async(myCustomQueue, ^{
[UIView animateWithDuration:myDuration
delay:0.0f
options:0
animations:^{
// my changes here
}
completion:nil];
});
dispatch_async(myCustomQueue, ^{
// if the animation from the task below is still running, this task should wait until it is finished...
});