Common Views

Overview

These are the most common views used on iOS.

UILabel

Labels display text. It defaults to a single line, but if you set the line count to 0, it will use multiple lines.

UIImageView

Image Vies display images. By default, user-interaction is disabled. If you attach gestures to the view, and nothing happens, remember to re-enable it.

UIButton

You can assign buttons to trigger code on tap, to "touch up inside" event. You could also trigger code on other events, like when the user first presses down, but hasn't lifted their finger.

UITextField

Text fields are for single lines of text input, like a form field. They're similar to an HTML input tag of type text.

UITextView

UITextView is for long blocks of (possibly editable) text.

UIScrollView

Unlike a webpage, if your view is too large to fit on screen, it won't automatically become scrollable. If you want to make a large view scrollable, place it inside a scrollview.

UITableview

Table views display long lists of items. It one of the most common root views on iOS. These are covered in greater detail in Table View Basics.

Fork me on GitHub