The drawRect: Method
So far, you have created a UIView subclass, created two instances of it, and inserted them into the view hierarchy.
We gave these two views instances distinguishable backgroundColors so that we can see their position and size on the screen. But views comprise all iOS interfaces, so clearly there must be a way to draw more than just colored rectangles. The drawing that makes a view interesting happens in the UIView method drawRect:. By default, drawRect: does nothing, but UIView subclasses override this method to perform custom drawing.
When you override drawRect:, you issue drawing instructions that create the image for instances of your UIView subclass. These drawing instructions come from the Core Graphics framework, ...