开发者

Clickable words in UILabel

Is there a 3rd party library which allows contents of UILabel (words) to receive events (for example click, double click, etc)? I'm interested 开发者_C百科in distinguishing which word received an event.


@Zepplock I dont know about any 3rd party library, but try this link,

UILabel touch and get the text where touched

I m not sure if the answer might help, but the user said that there is a sample code. so you can try it out.


The easiest way would be dividing your string and then displaying that parts on different UIButtons. But if you have a lot of text, then you probably need to check docs for Core Text. It will allow you to get coordinates of word/sentence/letter and then you can add some overlay (e.g. UIButton) that would receive touch events. Or you can override UIResponder methods and use gesture recognizers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜