I have some text coming from server. It may be single line or multiline text. I have to display the text on UILabel, which is no problem for me. The problem is, I have to display UIButton on finding a particular substring of the same text. For example the text is Nitish 435-234-6543 India which is being displayed as follows :
Nitish
435-234-6543
India
因此,当我发现435-234-6543时。 我必须在<>435-234-6543上显示UIButton。
注:
- The text is dynamic - coming from server. Above is only an example.
- UIButton will be a subview of UILabel.
I tried different ways like OHAttributedLabel, rectForLetterAtIndex and this too. But not getting success. What my idea is, to create the button when substring is found and to set the frame of button based on NSRange of substring. Is this a possibility? How can it be done? Or is there some other way to do this?
I guess it is the approach I am worried about.