Hi Brian,
let cancelButton: UIButton = {
let button = UIButton(type: .custom)
button.setImage(#imageLiteral(resourceName: "cancel_shadow"), for: .normal)
button.addTarget(self, action: #selector(onCancelButtonPress), for: .touchUpInside)
return button
}()
Do you know any possible reason why the onCancelButtonPress is not firing up?
The declaration is like this:
@objc private func onCancelButtonPress() {
print("CANCEL BUTTON PRESSED")
}
I encountered the same case where the event is not firing up on optionsButton in HomePostCell, I fixed it by adding the target after anchoring the optionsButton.
I tried adding the cancelButton event after setting the anchor but it doesn't work. I also tried setting it as lazy var, doesn't work either.