addButton on the custom tableview cell. It is all working before the update Xcode.
Add functions on same class but in custom cell view have button's properties.
Post
Replies
Boosts
Views
Activity
I'm sure the problem isn't caused by this but here my custom tableview cell whole code:
class customCell: UITableViewCell {
let testdetails = testdetail()
var count = 0
let cellView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
let imageOrderForCell: UIImageView = {
let iv = UIImageView()
iv.contentMode = .scaleAspectFit
iv.image = UIImage(named: "checked")
return iv
}()
let sepetLabel: UILabel = {
let label = UILabel()
label.text = "sepetteki ürün"
label.textColor = .darkGray
label.font = UIFont(name:"Comfortaa-Bold", size: 15)
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
let countBasketLabel: UILabel = {
let countLabel = UILabel()
countLabel.text = "x0"
countLabel.textColor = .orange
countLabel.font = UIFont(name:"Comfortaa-Bold", size: 15)
countLabel.translatesAutoresizingMaskIntoConstraints = false
return countLabel
}()
let priceBasketLabel: UILabel = {
let pricelabel = UILabel()
pricelabel.textColor = .black
pricelabel.font = UIFont(name:"Comfortaa-Bold", size: 15)
return pricelabel
}()
let deleteButton: UIButton = {
let button = UIButton(type: .system)
button.setImage(UIImage(named: "delete"), for: .normal)
button.tintColor = .black
button.layer.cornerRadius = 5
button.addTarget(self, action: #selector(testdetail.deleteAction(sender:)), for: .touchUpInside)
return button
}()
lazy var addButton: UIButton = {
let button = UIButton(type: .system)
button.setImage(UIImage(named: "add"), for: .normal)
button.tintColor = .black
button.layer.cornerRadius = 5
return button
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setup()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setup() {
backgroundColor = .clear
addSubview(cellView)
cellView.addSubview(sepetLabel)
cellView.addSubview(priceBasketLabel)
cellView.addSubview(countBasketLabel)
cellView.addSubview(addButton)
cellView.addSubview(deleteButton)
cellView.anchor(top: topAnchor, left: leftAnchor, bottom: bottomAnchor, right: rightAnchor, paddingTop: 4, paddingLeft: 8, paddingBottom: 4, paddingRight: 8, width: 40, height: 40)
sepetLabel.anchor(top: nil, left: cellView.leftAnchor, bottom: nil, right: rightAnchor, paddingTop: 0, paddingLeft: 6, paddingBottom: 0, paddingRight: 0, width: 25, height: 25)
sepetLabel.centerYAnchor.constraint(equalTo: cellView.centerYAnchor).isActive = true
priceBasketLabel.anchor(top: nil, left: nil, bottom: nil, right: deleteButton.leftAnchor, paddingTop: 0, paddingLeft: 10, paddingBottom: 0, paddingRight: 20, width: 0, height: 35)
priceBasketLabel.centerYAnchor.constraint(equalTo: sepetLabel.centerYAnchor).isActive = true
countBasketLabel.anchor(top: nil, left: nil, bottom: nil, right: addButton.leftAnchor, paddingTop: 0, paddingLeft: 1, paddingBottom: 0, paddingRight: 1, width: 30, height: 25)
countBasketLabel.centerYAnchor.constraint(equalTo: sepetLabel.centerYAnchor).isActive = true
addButton.anchor(top: nil, left: nil, bottom: nil, right: rightAnchor, paddingTop: 0, paddingLeft: 2, paddingBottom: 0, paddingRight: 8, width: 30, height: 30)
addButton.centerYAnchor.constraint(equalTo: sepetLabel.centerYAnchor).isActive = true
deleteButton.anchor(top: nil, left: nil, bottom: nil, right: countBasketLabel.leftAnchor, paddingTop: 0, paddingLeft: 2, paddingBottom: 0, paddingRight: 8, width: 30, height: 30)
deleteButton.centerYAnchor.constraint(equalTo: sepetLabel.centerYAnchor).isActive = true
}
}
I replaced that because I try to solve it but in original version is my first post. The problem continues.
Also I have class header of course.