我使用的是xcode10.0beta6,所以这可能只是一个bug。
UIView
-实例,似乎对属性没有任何影响。
leadingView
在里面
ViewTextFieldCell
:
class ViewTextFieldCell: UITableViewCell {
// ...
var leadingView = UIView()
// ...
}
按以下方式修改单元格实例时。。。
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = ViewTextFieldCell(style: .default, reuseIdentifier: "TestCell")
cell.leadingView.backgroundColor = .blue
let otherView = UIView()
otherView.backgroundColor = .green
cell.leadingView = otherView
return cell
}
... 唯一保留的更改是将背景色设置为蓝色。
otherView
没有效果。
这怎么可能?