IOS 取消表格单元格 TableViewCell 去掉高亮状态 点击Cell取消选择状态

以下是两种实现效果

1. 自定义cell 继承UITableViewCell  

 重写  

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

{

 

}

 

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

}

里面不写任何东西 

注意重写的时候一定要有带animated 方法,不然还是无效

2.点击单元格 取消选中单元格

//  点击单元格的时候取消选中单元格

-(void)tableView:(UITableView *)tableViewdidSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

    [tableView deselectRowAtIndexPath:indexPath animated:YES];

}

原文地址:https://www.cnblogs.com/llios/p/3921940.html