views:

495

answers:

2

I've been using uiLabels to put text in the cells of tableviews. I want to now use paragraph text that carriage returns to the next line instead of going out of the boundaries of the table cell. Would I do this by manipulating a uiLabel or would I use a different control all together like a text view.

Also is there any project examples out there that implement this?

Thanks, Joe

A: 

The simplest approach is to use a UILabel, probably. The only alternative would be to make a custom UIView subclass that draws the text directly, but that will give you marginal benefit.

Adam Ernst
+1  A: 

Simplest way is to use a UILabel and set the number of lines in IB to > 1 then set the line break to "Word Wrap."

Another way is to use a UITextView, load the data and set it to 'disabled' so it can't be edited.

Finally, you can always go the UIWebView route and load it with formatted HTML, complete with line breaks, etc. Pretty heavy, but most flexible.

Ramin