I have a UIButton that has four child UILabels that contain information about the button's functionality. When I click the center of the button the action does not fire because it is being blocked by the UILabels but when I click the outside of the button the action does fire. Is there a way to prevent the UILabels from blocking the action firing?
You'll need to set isUserInteractionEnabled = false
on any view that is above the button, or a subview of it.
By default UILabel
have it set to false
, but as you mentioned in the comments, UIStackView
does not. So calling isUserInteractionEnabled = false
on it will do the trick ┌( ಠ‿ಠ)┘
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With