iOS_UItableVeiwCell 点击取消高亮状态

来源:互联网 发布:桃心拼图软件 编辑:程序博客网 时间:2024/05/14 06:26
今天需要点击UItableVeiwCell取消选中时的高亮状态,把方法分享一下有两种方法, 我使用了第一种.第二种给大家也看看    1. 自定义cell 继承UITableViewCell       重写    - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated    {    }    - (void)setSelected:(BOOL)selected animated:(BOOL)animated {        }    里面不写任何东西     注意重写的时候一定要有带animated 方法,不然还是无效    2.点击单元格 取消选中单元格    //  点击单元格的时候取消选中单元格    -(void)tableView:(UITableView *)tableViewdidSelectRowAtIndexPath:(NSIndexPath *)indexPath    {        [tableView deselectRowAtIndexPath:indexPath animated:YES];}
0 0
原创粉丝点击