Skip to content

Instantly share code, notes, and snippets.

@zhangkn
Created May 4, 2018 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangkn/37a271df3bbd39860f9476ab92843707 to your computer and use it in GitHub Desktop.
Save zhangkn/37a271df3bbd39860f9476ab92843707 to your computer and use it in GitHub Desktop.
线程间通信示例
从子线程回到主线程
dispatch_async(
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// 执行耗时的异步操作...
dispatch_async(dispatch_get_main_queue(), ^{
// 回到主线程,执行UI刷新操作
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment