I am trying to dynamically add a UIbutton as a subview to UIlable. But I am not able to click the button. It seems that the label doesn't allow the buttonTapped event to occur.
Can somebody explain what exactly is happening here? and can anybody give me an alternative for this? thanks!
funny, I got answer on my own after 5 mins of posting this question. It seems that I had to enable my userInteraction on the labels.
i.e. -
lbl.userInteractionEnabled=YES;
Your question (and subsequent answer) don't speak to the wisdom (or lack thereof) of doing what you're attempting. UILabel objects aren't generally meant to be interactive, and placing a UIButton as a subview to the label, just because you can do it, doesn't sound at all like it's following the Apple HIG for iPhone.
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