简体   繁体   English

重新加载表格视图的选定单元格

[英]reload selected cell of a tableview

So I have a tableView which is first rendering data fetched from one json and then will get second json which consist of last updated parameter. 因此,我有一个tableView,它首先呈现从一个json提取的数据,然后将获取第二个由最后更新的参数组成的json。

No using this I want to update only those cells in tableview whose update value is greater than 1 day. 不使用它,我只希望更新tableview中更新值大于1天的那些单元格。

reload data is doing the job but updating all the cell. 重新加载数据的工作,但更新所有单元。

Is there any way to update only specific cells of tableview based on json result? 有什么方法可以根据json结果仅更新tableview的特定单元格吗?

通过indexPath重新加载单元格的func: reloadRows(at:with :)

您可以通过以下方法在特定的Indexpath处使用reload UITableView

func reloadRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) 

我建议您使用NSFetchedResultsController,在此处阅读有关内容: https : //cocoacasts.com/populate-a-table-view-with-nsfetchedresultscontroller-and-swift-3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM