开发者社区> 问答> 正文

请问 iOS 异步加载的数据该如何用TableView显示呢

比如我在某个ViewController中添加一个TableView来显示数据,每个TabelViewCell显示一个 Post自定义对象ViewController类里面定义一个 NSMutableArray *posts 来填充很多 Post 对象 而且 TableView 也与 posts 紧密关联 如果填充方法是在 ViewController 的 viewDidLoad 方法里执行的则 TableView 显示一切正常 但现在的情况是 。我需要使用 http get 操作异步加载数据到 posts 中

展开
收起
杨冬芳 2016-07-01 17:37:22 3070 0
1 条回答
写回答
取消 提交回答
  • IT从业

    iphone开发,通过HTTP协议获取数据或者TCP协议获取的数据,需在主线程中加载数据,否则容易出现程序崩溃现象,比如以下异常:bool _WebTryThreadLock(bool), Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashin

    2019-07-17 19:50:17
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
手淘iOS性能优化探索 立即下载
From Java/Android to Swift iOS 立即下载
深入剖析iOS性能优化 立即下载