Essential factors to be considered while choosing UILabel and UITextView to display text for iOS, iPadOS and macOS apps.

Choosing between UILabel and UITextView starts when you want to display text in your Apple iOS, iPadOS or macOS Catalyst App.

I have even gone through the process of choosing UILabel or UITextView to display text on my app.

So, I have made a small numbered list to help you choose the right option…

Choose UILable to display text:

  1. If the text word count is small in number
  2. If Top Aligning text to the top border is not the requirement
  3. UILable is not tappable interactive, or selectable to the user’s input
  4. if you want to automatically adjust the font size and fit text to the UILabel bounding box layout

Here is a Sample Code for UILabel:

self.helpUILabelText.textAlignment = .left
self.helpUILabelText.font = UIFont.systemFont(ofSize: 15, weight: .regular)
self.helpUILabelText.numberOfLines = 0
self.helpUILabelText.text = "Your Text"
self.helpUILabelText.textColor = .black
self.helpUILabelText.lineBreakMode = .byTruncatingTail
self.helpUILabelText.isHidden = false

Choose UITextView to display text:

  1. If the text has a big word count
  2. If you want to text alignment by default
  3. If you want text view to be scrollable / You can mark this feature as false; also
  4. If you want it interactive with taps from the user / You can mark this feature as false, also
  5. If you want it editable by the user / You can mark this feature as false, also
  6. If you want it to be selectable by the user / You can mark this feature as false, also
  7. If you want line breaks or paragraph text automatically

Here is the Sample Code for UITextView

self.helpUITextView.textAlignment = .left
self.helpUITextView.font = UIFont.systemFont(ofSize: 15, weight: .regular)
self.helpUITextView.text = "Your Text"
self.helpUITextView.textColor = .black
self.helpUITextView.backgroundColor = .clear
self.helpUITextView.isHidden = false
self.helpUITextView.isEditable = false
self.helpUITextView.isScrollEnabled = true
self.helpUITextView.isSelectable = false

I hope this information helps you to select the right ‘view’ to display text.

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.