objective-c - 是否可以刷新 UITableView 中的单个 UITableViewCell?

标签 objective-c uitableview

我有一个使用 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 - UItableViewCell : Remove observer

iphone - 如何创建可变大小的 UITableViewCell?

ios - 如何在 iOS Objective C 中更改日期选择器 View 和选择器 View 的字体大小

objective-c - 使用对象填充 NSMutableSet 不起作用 - NSLog 和调试器显示 Null

ios - 快速将文本字段添加到 UITableViewCell

ios - 添加了超过 20 个 tableviewcells 但之后无法滚动 tableview 以查看 jonkykong/SideMenu iOS 演示应用程序中的所有单元格

ios - UIViewController 延迟加载

ios - 当网络连接缓慢时应用程序卡住,因为 POST API 调用发生在应用程序启动时。下面是我的连接管理器代码,Objective-C,iOS

ios - AFNetworking 使用 URL 设置 UITableViewCell 的 imageView 图像,设置图像后 imageview 框架仍然为 0

ios - 类型不符合协议(protocol)序列类型 - Swift