开发者

How to write long formatted text in a Text View with xCode

I feel strange asking a question about what's probably the simplest page in my iPhone app but here it is anyway:

I have a controller that a user can invoke to display the rules of the game and some acknowledgment information. I set up a Text View object filling up the whole page in Interface Builder and am wondering what's the best way of entering the text I need.

I can do all of this in the m file but entering large text sections in a programming language 开发者_如何转开发is never fun.

I can also simply overwrite the default "Lorem ipsum dolor..." text in Interface Builder but then my return characters don't seem to be taken into account when I run the app.

Is there a better way to fill my Text View with my own formatted text? And how can I format my text neatly and easily (i.e. make titles in bold, underline some words, etc.)?

Thanks.


There is no way to easily display formatted text in a UITextView. The best approach for this kind of problem is to use a UIWebView and store the text as an HTML file.


Use the NSTextStorage class to store the formatted text in your NSTextView.


Use Core Text Core Text Tutorial for iOS: Making a Magazine App

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜