主线程,执行UI刷新
dispatch_async(dispatch_get_global_queue(0, 0), ^{
//执行耗时的异步操作..
//................
//................
dispatch_async(dispatch_get_main_queue(), ^{
//回到主线程,执行UI刷新操作
//................
//................
});
});
延时操作
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//code to be executed after a specified delay code将在10后执行
});
网友评论