我有一个使用 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/
相关文章:
ios - 以编程方式创建 UICollectionView
objective-c - Objective-C中方法旁边的加号和减号是什么意思?
ios - 在 UITableViewCell 中有一个 UITextField
ios - 为 iOS 7 半透明 UINavigationBar 实现明亮、生动的色彩
objective-c - Objective-C Cocoa 应用程序中的正则表达式
objective-c - 解决 Objective-C 命名空间冲突的最佳方法是什么?
ios - 如何在 NSAttributedString 中创建可点击链接?