从API uitableview不断更新数据源

时间:2017-10-24 04:30:39

标签: ios iphone api uitableview

我想创建一个带有tableview的iOS应用程序,该应用程序显示来自API的列表字符串数据。数据可以连续更新,所以我希望我的tableview可以连续更新数据源。 这个应用程序像银行里的汇率板。 有人给我一些建议吗?非常感谢你!

1 个答案:

答案 0 :(得分:0)

如果您不需要动画,可以在数据更新时随时致电-(void)reloadDate

<...>
[self updateDataSource];
[self.tableView reloadData];
<...>

如果你需要一些动画,你应该使用other methods

<....>
[self.tableView beginUpdate];
[self updateDataSource];
[self.tableView insertRowsAtIndexPaths:<inserted rows index paths> withRowAnimation:<animation>]; 
[self.tableView endUpdates];
<...>