Over the next five chapters, you are going to build an application named WorldTrotter. When it is complete, this app will convert values between degrees Fahrenheit and degrees Celsius. In this chapter, you will learn about views and the view hierarchy through creating WorldTrotter’s user interface. At the end of this chapter, your app will look like Figure 3.1.
Figure 3.1 WorldTrotter
Let’s start with a little bit of the theory behind views and the view hierarchy.
Recall from Chapter 1 that views are objects that are visible to the user, like buttons, text fields, and sliders. View objects make up an application’s user interface. A view
- is an instance of UIView or one of its subclasses
- knows how to draw itself
- can handle events, like touches
- exists within a hierarchy of views whose root is the application’s window
Let’s look at the view hierarchy in greater detail.