开发者

UILabel and superscript

开发者 https://www.devze.com 2022-12-21 01:34 出处:网络
I have two strings: a variable length piece of text 开发者_如何学JAVAanother string with numbers that

I have two strings:

In my view, the first piece of text is displayed in a UILabel, I adjust the size of the label to accomodate the size of the text. This means I cannot just place another UILabel on the screen, at least not without repositioning it...somehow.

I need to be able to put the second piece of text so it appears to be at the end of the sentence - and superscripted

I really have no idea how to achieve this!


My rather dodgy solution was to enter unicode characters for the superscripted numbers.

Not a great solution but it worked.


The simplest way would be to use two different UILabels. A better solution might be to draw both strings using -drawInRect:withFont: in a custom view's -drawRect: method.

0

精彩评论

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

关注公众号