UILabel touch and get the text where touched

前端 未结 5 756
一整个雨季
一整个雨季 2020-12-08 18:05

I\'ve UILabel which has some text and 2 month names like \"In the month of January and July, sun shine will be peak\" I sub classed UILabel and added touch event to it. Now

5条回答
  •  醉梦人生
    2020-12-08 18:16

    I think you'll find what you're looking for in the documentation for UITextInputProtocol.

    For some more high level information, check out Apple's Text, Web and Editing Guide, specifically in the section titled "A Guided Tour of a UITextInput Implementation". It discusses how you can create indexed positions in text, and ask touches what text position they've landed nearest.

    Apple's references a sample projected called SimpleTextInput, but I can't seem to find it. I'll keep looking.

提交回复
热议问题