美文网首页
Project9- GCD(Grand Central Disp

Project9- GCD(Grand Central Disp

作者: 终极解码者 | 来源:发表于2016-09-29 12:23 被阅读0次
  1. performSelector
//在子线程中执行
performSelector(inBackground: #selector(fetchJSON), with: nil)
//在主线程中执行
tableView.performSelector(onMainThread: #selector(UITableView.reloadData), with: nil, waitUntilDone: false)
  1. async()
//开辟一个qos队列,在其中执行
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
}
//在主线程
DispatchQueue.main.async { [unowned self] in
    self.tableView.reloadData()
}

相关文章

网友评论

      本文标题:Project9- GCD(Grand Central Disp

      本文链接:https://www.haomeiwen.com/subject/aawkyttx.html