一般定制的cell 如何改变选中时改变cell 上图片(不是背景图)的方法。

- (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型没有测试。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值