在自定义的cell里重写layoutSubviews()方法,然后遍历替换
override func layoutSubviews() {
super.layoutSubviews()
for control in self.subviews{
if control.isMember(of: NSClassFromString("UITableViewCellEditControl")!) {
for v in control.subviews{
if(v.isKind(of: UIImageView.self)){
let img = v as! UIImageView
if(self.isSelected){
img.image = UIImage(named: "btn_choice_s")
}else{
img.image = UIImage(named: "btn_choice_n")
}
}
}
}
}
}
|
请发表评论