UITableViewCell去掉点击效果

我们在点击UITableView 的cell时,会出现阴影,如不做处理,就会一直显示,怎么样让它点击之后就消失呢?只要重写UITableView的代理方法,就可以解决,方式如下:

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

{

//当手指离开某行时,就让某行的选中状态消失

[tableView deselectRowAtIndexPath:indexPath animated:YES];

}

第二,代码代码中修改

UITableViewCell *cell;

......

......

cell.selectionStyle = UITableViewCellSelectionStyleNone;

你可能感兴趣的:(UITableViewCell去掉点击效果)