我有一个UITableView。我想根据所做的选择更新表数据。现在我使用[mytable reloadData];我想知道是否有什么方法可以更新所选的特定单元格。我可以使用NSIndexPath或其他修改吗?有什么建议?

谢谢。

最佳答案

对于iOS 3.0及更高版本,您只需致电:

- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;

例如,要重新加载第2部分的第3行和第3部分的第4行,您必须执行以下操作:
// Build the two index paths
NSIndexPath* indexPath1 = [NSIndexPath indexPathForRow:3 inSection:2];
NSIndexPath* indexPath2 = [NSIndexPath indexPathForRow:4 inSection:3];
// Add them in an index path array
NSArray* indexArray = [NSArray arrayWithObjects:indexPath1, indexPath2, nil];
// Launch reload for the two index path
[self.tableView reloadRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationFade];

关于iphone - 在iOS中重新加载特定的UITableView单元,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7040740/

10-14 22:17