How to keep 2 different fonts within the same UITextField or UITextView?

后端 未结 5 2059
我在风中等你
我在风中等你 2020-12-04 02:54

I want to set 2 different fonts within the same UITextField and UITextView . How to do it?

5条回答
  •  伪装坚强ぢ
    2020-12-04 03:14

    Its a bit of work - you'll need to use Core Text and NSAttributedString to do this.

    There are plenty of tutorials and examples, although I'd suggest using someone else's already-made UILabel subclass such as:

    OHAttributedLabel

    or

    TTAttributedLabel

    As these usually have some convenience methods to make handling a lot easier.

提交回复
热议问题