我有一个UITableView,在我的-tableView:didSelectRowAtIndexPath:
方法中我想要改变两个单元格的外观(刚刚选中的单元格和之前选择的单元格)。我用这种方法做到了:
// reload both rows to change appearance
if (![indexPath isEqual:activeIndexPath]) {
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:activeIndexPath, indexPath, nil]
withRowAnimation:UITableViewRowAnimationAutomatic];
}
使用参数UITableViewRowAnimationAutomatic
设置它可以很好地工作:相应的行以平滑过渡进行更新。但我希望这两行在没有动画的情况下立即更新。
我认为UITableViewRowAnimationNone
可以做到这一点,但如果我将这个常量用于行动画,则单元格根本不会更新