关于自定义UITableView选中之后的状态

一直想记录来着

在cell里要先把系统的选中状态禁掉

[self setSelectionStyle:UITableViewCellSelectionStyleNone];

然后

-(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{

    [super setHighlighted:highlighted animated:animated];

    if (highlighted) {

        _innerBackgroundImageView.image = [UIImage imageNamed:@"cell_bg_pre"];

    }else{

        _innerBackgroundImageView.image = [UIImage imageNamed:@"cell_bg_nor"];

    }

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

    if (selected) {

        _innerBackgroundImageView.image = [UIImage imageNamed:@"cell_bg_pre"];

    }else{

        _innerBackgroundImageView.image = [UIImage imageNamed:@"cell_bg_nor"];

    }

    [super setSelected:selected animated:animated];

    // Configure the view for the selected state

}

你可能感兴趣的:(关于自定义UITableView选中之后的状态)