如何实现以下块?
我需要在后台运行一些任务.然后在后台任务完成后,一些任务将在主线程中运行.
为什么我使用块是因为我需要更新传递给此方法的视图.
- (void)doALongTask:(UIView *)someView {
[self doSomethingInBackground:^{
// Runs some method in background, while foreground does some animation.
[self doSomeTasksHere];
} completion:^{
// After the task in background is completed, then run more tasks.
[self doSomeOtherTasksHere];
[someView blahblah];
}];
}
Run Code Online (Sandbox Code Playgroud)
或者有更简单的方法来实现这个?谢谢.