How can I emphasize part of the text, for example, iPhone SMS?

I use UILabel to display my text in multi-line mode and in UILineBreakModeWordWrap mode, and the maximum width is 200.
For example, here is the text:

I really really want to underline first word and second word, could you help me?

And I want to emphasize the "first word" and "second word".

If the text is shown in single-line mode, with the sizeWithFont method for NSString, I can easily calculate the position of the "first word" and then override - (void) drawTextInRect: (CGRect) rect to draw a line.

But in multi-line mode, I do not know how to get a position. Do you have any ideas?

+3
source share
2

NSAttributedString iPhone, , . . , Three20 TTStyledTextLabel.

+6

UIWebView . , Apple .

+5

Source: https://habr.com/ru/post/1709967/


All Articles