tableview 选中一行后,不显示选中颜色,不要将tableview的allowsSelection设置成NO,那样的话可能致使tableview不能响应点击动 做。合理的解决方法是:函数
直接在建立cell的时候:动画
cell.selectionStyle = UITableViewCellSelectionStyleNone;
或者你是经过XIB建立的cell那么写在xib的nib里边也是能够的:(原理相同)spa
- (void)awakeFromNib { //取消cell 选中风格 self.selectionStyle = UITableViewCellSelectionStyleNone; }
还有没有别的?再试试这个回调的函数来取消code
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; //NO关闭动画效果 }
(不过这个会闪一下哦,可是也算一种方式撒)it
固然 还有一种就是 cell建立的时候 你在建立一个画布 把它覆盖了 可是 有简单的你肯定你还要本身建立?io
//取消选中颜色 UIView *backView = [[UIView alloc] initWithFrame:cell.frame]; cell.selectedBackgroundView = backView; cell.selectedBackgroundView.backgroundColor = [UIColor clearColor];