5 Views: Redrawing and UIScrollView

In this chapter, you are going to see how views are redrawn in response to an event. In particular, you will update Hypnosister so that when the user touches the BNRHypnosisView, its circle color will change. A change in color which will require the view to redraw itself. Later in the chapter, you will also add a UIScrollView to Hypnosister’s view hierarchy.

The first step is to declare a property for the color in BNRHypnosisView. In earlier applications, you declared properties in header files. You can also declare properties in class extensions.

Open BNRHypnosisView.m and add the following code near the top of the file.

#​i​m​p​o​r​t​ ​"​B​N​R​H​y​p​n​o​s​i​s​V​i​e​w​.​h​"​

@​i​n​t​e​r​f​a​c​e​ ...

Get iOS Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.