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
345 views
in Technique[技术] by (71.8m points)

ios - Format text in UITextView

I am making an "About Page" for my application, and I have to paste pretty huge amount of text on that page (text will not be editable).

I am using a UITextView for this purpose. However, I need some words to be in bold (like headings). But I am not able to achieve it. The UITextView removes all my formatting.

I have no code to show here because I am pasting all my text in the IB only.

Is there any workaround?? For example.. I want the heading in bold..

"About ABC Corporation

gkskgsagdfgfskgfjkgfgljdgsfjgdsjfgdjlsgflgdslgfljdsgfljgdsjlgfljdsgfljdgslfgls.
jdfjkhdsjlfhdlsfhkldshfkldshflkdhlkfhdklsfhlksdhflkdshflkhdsflkhsdklfhlksdhflkshf

fjhdshfkldshfkldhsfklhdsklfhlkdshfklhdsklfhdklsfhkdshfklhdsklfhklsdfhkldshfkhdsklf

fhjdgfkdgsjkfgjkdsgfjkdsgjfgjdkgfjgsjdfgjkdsgfjkgsdjkfgjsdgfjgsdjkfgjksdgfjkgskjfgs"
See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

First keep text property of textView as 'Attributed', after that just select the text and change it's style and font as you want.

P.S. - All you have to do this in Attribute inspector panel of IB.

EDIT:

For more, visit this link .

Also, this is very good mainly when the textField have a text that will not change, e.g. - like About info. And when this text is inserted in IB directly instead of assigning text programmaticaly.


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

...