Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a UILabel and I would like to make it react to a touch. I tried putting a button on top of the label, thanks to this I could interact with the button. However, the button cannot be fully transparent, right? I could set an alpha of the button to 0,02, but it is still visible on by background. How to solve this? Maybe I could set the properties in some other way to make them fully invisible? Or is there some other solution?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
530 views
Welcome To Ask or Share your Answers For Others

1 Answer

First, why not just use a button and set the button title to the label's contents?

If you can't/don't want to do that, you can also set userInteractionEnabled = YES on the label and then add a gesture recognizer to the label.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...