- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// 让定制的cell点击时换掉图片
LeftCell *cell = (LeftCell *)[tableView viewWithTag:indexPath.row +1]; //在cell重用方法里面给每一个cell 设置Tag = indexPath.row +1,这里不能是Tag = indexPath.row,因为为0的时候 [tableView viewWithTag:indexPath.row ]返回的是一个tableView,而不是cell。
cell.titleimage.image = [UIImage imageNamed:@"12.png"]; //titleimage为你定制cell的一个属性、
for (int i = 1; i<_dataList.count +1; i++) { //_dataList 可以理解为有row的总数。
if (i != indexPath.row+1) {
LeftCell *cell1 = (LeftCell *)[tableView viewWithTag:i];
cell1.titleimage.image = [UIImage imageNamed:@"10.png"];
}
}
}
适用于
UITableViewStylePlain型,group型没有测试。