Ios 展开uitableviewcell时丢失属性
我有一个属性,即单元格中的图像展开,当单元格中的脉冲指定selectedIndexPath时,您可以在相应的方法中更改高度,我希望该图像在单元格展开时更改,问题是,当我展开单元格时,图像会发生变化,但当我抛出动画展开单元格时,图像会返回到上一个图像,并重新绘制Ios 展开uitableviewcell时丢失属性,ios,objective-c,uitableview,tableview,Ios,Objective C,Uitableview,Tableview,我有一个属性,即单元格中的图像展开,当单元格中的脉冲指定selectedIndexPath时,您可以在相应的方法中更改高度,我希望该图像在单元格展开时更改,问题是,当我展开单元格时,图像会发生变化,但当我抛出动画展开单元格时,图像会返回到上一个图像,并重新绘制 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath [tableView deselectRowAtInd
-(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重新加载RowsatindExpaths:@[indexPath]with RowAnimation:UITableViewRowAnimationAutomatic];,
有人能帮我吗?
谢谢 您需要在数据源中维护这些值,而不是在视图本身上。因此,在cellForRow中,您可以检查数据源,并根据需要显示单元格。非常感谢您的朋友,已经解决的问题是,必须提取更多数据