Better to use a custom accessor?


#1

Right now, the app only changes color due to touch events. But, what if you later decided to change the circle color using a timer every 3 seconds. You’d then need to call setNeedsDisplay when the timer fired. In both cases, the view doesn’t need to be redrawn because the screen was tapped or the timer fired, but because the circle color changed and therefore the visual appearance of the view changed. Because of this, it would still be best to put the call to setNeedsDisplay in the setCircleColor: method, since that is at the heart of why the screen needs to be redrawn.