double07
double07

Reputation: 2575

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.

Upvotes: 0

Views: 4041

Answers (3)

Azam
Azam

Reputation: 797

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

Upvotes: 0

Rob Napier
Rob Napier

Reputation: 299265

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.

Upvotes: 1

TheAmateurProgrammer
TheAmateurProgrammer

Reputation: 9392

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

Upvotes: 0

Related Questions