且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

更新数据异步后重绘UITableView

更新时间:2021-11-04 22:32:06

你说你是在异步填充内容但你是否在主线程的上下文中调用reloadData? (而不是通过填充内容的主题)

You said you're populating content asynchronously but did you invoke the reloadData in the context of the main thread ? (and not via the thread that populates the content)

Objective-C

[yourUITableView performSelectorOnMainThread:@selector(reloadData)
                                  withObject:nil 
                               waitUntilDone:NO];

Swift

dispatch_async(dispatch_get_main_queue(), { self.tableView.reloadData() })

Monotouch

InvokeOnMainThread(() => this.TableView.ReloadData());