From: FriendRequestCell.Swift
private func setupAcceptButton() {
acceptButton.translatesAutoresizingMaskIntoConstraints = false
acceptButton.setTitle("ACCEPT", for: .normal)
acceptButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 12)
let gradient = setupGradientLayer()
gradient.frame = bounds
acceptButton.layer.insertSublayer(gradient, at: 0)
acceptButton.tintColor = .white
acceptButton.layer.cornerRadius = 12
acceptButton.layer.masksToBounds = true
debugPrint("*** Marker 10")
acceptButton.addTarget(self, action: #selector( addButtonPressed), for: .touchUpInside)
debugPrint("*** Marker 11")
addSubview(acceptButton)
let constraints = [
acceptButton.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -16),
acceptButton.bottomAnchor.constraint(equalTo: centerYAnchor),
acceptButton.widthAnchor.constraint(equalToConstant: 75),
acceptButton.heightAnchor.constraint(equalToConstant: 20)
]
NSLayoutConstraint.activate(constraints)
//addButtonPressed()
}
accecpt.addTarget is the issue. Nothing happens when touched.
The syntax seems to correct. The order seems to be correct as well.
I question the location of it, though.
Or is it something simple?
Marker 10 and 11 do show up without error.