Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
286 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...