O'Reilly logo

iOS Programming: The Big Nerd Ranch Guide by Joe Conway, Aaron Hillegass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6Subclassing UIView and UIScrollView

In previous chapters, you’ve created several views: a UIButton, a UILabel, etc. But what exactly is a view?

  • A view is an instance of UIView or one of its subclasses.

  • A view knows how to draw itself on the application’s window, an instance of UIWindow.

  • A view exists within a hierarchy of views. The root of this hierarchy is the application’s window.

  • A view handles events, like touches.

In this chapter, you are going to create your own UIView subclass that fills the screen with concentric circles, as shown in Figure 6.1. You will also learn how to draw text and enable scrolling and zooming.

Figure 6.1  View that draws concentric circles

In Xcode, select FileNewNew Project.... From the iOS section, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required