您更改了基础数据结构的图像。之后,在适当的索引路径重新加载单元格。
例如,我假设您的数据是一个简单的 NSArray,其中包含 NSDictionary 对象。字典包含一些键,例如“text”和“image”。在cellForRowAtIndexPath:您将使用适当字典中的值来设置 cell.text 和 cell.image。
所以,在accessoryButtonTappedForRowWithIndexPath:(或者也许你想要didSelectRowAtIndexPath:?),你会做这样的事情:
NSDictionary* dict = [myArray objectAtIndex:indexPath.row];
[dict setValueForKey:@"image":myNewImage];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation: UITableViewRowAnimationAutomatic];
请记住,这是伪代码,未经测试,但会给你如何做的想法。