swift3.0 挖出tablecell 自带选中
2017-09-07 本文已影响0人
0o简单o0
override func layoutSubviews() {
for item in self.subviews {
if item.isMember(of: NSClassFromString("UITableViewCellEditControl")!) {
let control : UIControl = item as! UIControl
for view in control.subviews {
if view.isKind(of: UIImageView.self) {
let img : UIImageView = view as! UIImageView
img.snp.makeConstraints({ (make) in
make.centerY.equalTo((self.goodsImage?.snp.centerY)!)
make.left.equalTo(8)
})
if self.isSelected {
img.image = UIImage.init(named: "check_icon")
}
else{
img.image = UIImage.init(named: "uncheck_icon")
}
}
}
}
}
super.layoutSubviews()
}