我有一个使用 UITableViewCell
的自定义 UITableView
。
每个 UITableViewCell
有 2 个按钮。单击这些按钮将更改单元格内 UIImageView
中的图像。
是否可以分别刷新每个单元格以显示新图像? 任何帮助表示赞赏。
最佳答案
获得单元格的 indexPath 后,您可以执行以下操作:
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPathOfYourCell, nil] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
在 Xcode 4.6 及更高版本中:
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:@[indexPathOfYourCell] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
当然,你可以设置任何你喜欢的动画效果。
关于objective-c - 是否可以刷新 UITableView 中的单个 UITableViewCell?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4448321/