禁用uitableview高亮显示,但允许选择单个单元格 [英] disable the uitableview highlighting but allow the selection of individual cells

查看:87
本文介绍了禁用uitableview高亮显示,但允许选择单个单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您点击一个单元格时,该行将被选中并突出显示.现在我想做的是禁用突出显示但允许选择.是否有解决的办法.有一个问题可以回答这一问题,但它同时禁用了选择和突出显示.

when you tap on a cell the row gets selected and highlighted.Now what i want to do is disable the highlighting but allow the selection.Is there a way around it.There is question that answers this but it disables both the selection and highlighting.

推荐答案

您可以从Storyboard中将单元格的选择样式设置为"None":

You can just set the cell's selection style to "None" from Storyboard:

或通过代码:

cell.selectionStyle = UITableViewCellSelectionStyleNone;

对于Swift 3:

cell.selectionStyle = UITableViewCellSelectionStyle.none

对于Swift 4&以上:

For Swift 4 & above:

cell.selectionStyle = .none

这篇关于禁用uitableview高亮显示,但允许选择单个单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆