Search code examples
iphoneiosuser-interfaceuilabeluitextview

iOS UI best practice - UILabel or UITextView?


If you are creating an UIView for an iPhone application to display an article from a blog, for example.

What UI component would you recommend to display the article's body? An UILabel with numberOfLines equals to zero or an UITextView with no scrolling and fixed size?

Why?


Solution

  • Update: As I commented below, I agree this is not the best answer these days. It was more accurate back in 2013, but today you should use a text view for a large text field. I cannot delete this, as it's the accepted answer, but I agree (and voted for) Vishnu's answer below.

    This depends a bit on what exactly you're trying to do.

    If you need to display static text with no editing features and no selection features, you should use a UILabel and place it in a UIScrollView if necessary.

    If you need selection or editing, use UITextView.