我有一个属性是单元格中的图像扩展,当单元格中的脉冲分配了 selectedIndexPath 时,您在相应方法中更改高度,并且我希望该图像在单元格扩展时更改,问题是当我展开单元格会发生变化,但图像会返回到前一个,当我抛出动画以展开单元格时会重新绘制。
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
[tableView deselectRowAtIndexPath:indexPath animated:TRUE];
IACCell *cell = (IACCell *) [tableView cellForRowAtIndexPath:indexPath];
if(!self.selectedIndexPath||![self.selectedIndexPath isEqual:indexPath]){
self.selectedIndexPath=indexPath;
tableView.scrollEnabled = NO;
cell.imageView.image =[UIImage imageNamed:@"image"];
}else{
self.selectedIndexPath=nil;
tableView.scrollEnabled = YES;
}
[tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
cell.imageView.Image 短暂更改,我认为问题出在 [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; 中,有人可以帮我吗?谢谢!