从 API uitableview 持续更新数据源



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

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

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

如果你需要一些动画,你应该使用其他方法:

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

最新更新