异步加载数据到 UITableView [英] Loading Data Asynchronously into UITableView

查看:51
本文介绍了异步加载数据到 UITableView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 xCode 7 beta 和 swift,并使用 Parse.com 存储我的数据.我应该在 UITableViewController 中的哪个方法中从我的数据库中请求数据?我需要确保它在控制器生命周期中需要呈现单元格的点都存在.

I am using xCode 7 beta and swift, and storing my data using Parse.com. In which method in the UITableViewController should I be asking for data from my database? I need to ensure it is all present by the point in the lifecycle of the controller at which the cells need to be presented.

如果我异步加载数据,是否可以保证这一点?

Is there anyway to guarantee this if I am loading data asynchronously?

推荐答案

viewDidLoad 将是一个好地方,但显示空白 tableView 之间可能会有几秒钟的差异代码>以及何时填充取决于提取数据所需的时间.

viewDidLoad would be a good place for this but there might be a few second difference between displaying a blank tableView and when it gets populated depending on how long it takes to pull your data.

所以在 viewDidLoad 中你会告诉 Parse SDK 拉取数据,当它完成时,你可以调用 [self.tableView reloadData]

So in viewDidLoad you'll tell the Parse SDK to pull data and when it's complete, you can call [self.tableView reloadData]

这篇关于异步加载数据到 UITableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆