要实现如图自定义 cell 点击时的半透明背景色.
在 cellForRow 中写如下代码不起作用:
let bgView = UIView(frame: cell.bounds)
bgView.backgroundColor = .white
bgView.alpha = 0.1
cell.selectedBackgroundView = bgView
应改为
let bgView = UIView(frame: cell.bounds)
bgView.backgroundColor = RGBA(r: 255, g: 255, b: 255, a: 0.1)
cell.selectedBackgroundView = bgView