(iphone)如何只更新tableview中的一行

Gao*_*188 1 uitableview ios

我有一个tableview,我将tableview每隔一秒更新.it接收数据中的数据,当收到数据时,它将替换一行中的旧数据.我喜欢这样:当收到数据时,我打电话

[m_tableView reloadData];
Run Code Online (Sandbox Code Playgroud)

所以,它会打电话

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath  *)indexPath{ }
Run Code Online (Sandbox Code Playgroud)

所以我将更改此方法中的特定行数据,但我该如何设置row index

Ash*_*lls 5

你有没有尝试过

- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
Run Code Online (Sandbox Code Playgroud)

迅速

func reloadRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation)
Run Code Online (Sandbox Code Playgroud)

这将允许您重新加载单行.

reloadData方法重新加载整个表