//分隔线
@property(nonatomic,strong)UIView*separatorLine;
_separatorLine= [UIViewnew];
[self.contentViewaddSubview:_separatorLine];
[_separatorLinemas_makeConstraints:^(MASConstraintMaker*make) {
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(20);
make.width.mas_equalTo(kScreenWidth-20);
make.height.mas_equalTo(1);
}];
_separatorLine.backgroundColor= [UIColorblackColor];
//重写点击选中方法 核心代码 这样点击选中tableViewCell 绘制的UIView*separatorLine就不会消失
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[supersetHighlighted:highlightedanimated:animated];
self.separatorLine.backgroundColor= [UIColorblackColor];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[supersetSelected:selectedanimated:animated];
self.separatorLine.backgroundColor= [UIColorblackColor];
}