【发布时间】:2012-05-12 00:54:22
【问题描述】:
【问题讨论】:
标签: ios iphone objective-c uitableview
【问题讨论】:
标签: ios iphone objective-c uitableview
你可以在tableview上调用[self.tableview reloadData];,刷新整个表格。
否则,您可以这样做来刷新单个单元格。
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPathOfYourCell] withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
【讨论】:
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath 中。
由于您已经拥有单元格的 indexPath,因此有时这可能只是工作
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
[cell reloadInputViews];
【讨论】:
您可以调用UITableView 类的reloadRows(at:with:) 方法,使用给定的动画效果重新加载UITableView 实例的某些行。
请注意,如果您想在 UITableView 实例中插入或删除某些行,则有类似命名的 insertRows(at:with:) 和 deleteRows(at:with:) 方法。
【讨论】: