Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios: best way to display variable-length, multi-line text

Tags:

I'm planning on loading multi-paragraph content from a text file and displaying it on the UI. I'll be loading from one of several text files and won't know ahead of time how long the text is going to be. My first thought was to use a UILabel inside a UIScrollView. However, it doesn't seem like UILabel can be made to expand based on the number of lines it contains. Is this correct?

If UILabel isn't the right tool for the job, what should I use? UIWebView? Will UIWebView handle the scrolling nicely for me?

like image 887
morgancodes Avatar asked Apr 21 '11 17:04

morgancodes


1 Answers

Check out UITextView. You can place one inside a UIView, and the text view provides all the functionality of a scroll view, and more (it is a UIScrollView subsclas).

like image 92
Mark Granoff Avatar answered Oct 05 '22 10:10

Mark Granoff