我的应用程序中有一个自定义 UITableViewCell
。我在初始化时向单元格添加了一个 View 。
class RestaurantCell: ListTableViewCell {
public let stripeView: UIView = UIView()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
addSubview(stripeView)
}
}
现在,当用户触摸应用程序时,灰色突出显示将覆盖我的自定义 View ,但不会覆盖 textLabel
或 detailTextLabel
。
为了解决这个问题,我尝试在 textLabel
或 selectedBackgroundView
上方添加 stripeView
。那并没有解决问题。有什么想法吗?
最佳答案
您要添加的元素应该是“自定义 View ”的子元素,以便突出显示,您可以检查一下 textLabel 和DetailTextLabel 是否都是子元素吗?
关于ios - UITableViewCell 突出显示覆盖我的自定义 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56038735/