The context passed belongs to CALayer, also returned by this delegate method. This is usually a display context, but it can also be an image or PDF context if the layer is drawn manually using -renderInContext:
CALayers can exist independently or be used as support for UIView. All UIViews have a layer behind them that handles the actual display of the contents of this view. Drawing in the view is actually drawn on its layer, and thus drawing in CALayer, which supports UIView, will be displayed for presentation.
As I said, you can create CALayers that exist as separate objects and add them to existing layers as sublayers for display. At some point, there should be a UIView that places all of these sublayers in its background layer so that these layers appear on the iPhone screen.
Note that according to the UIView class reference :
Since the view is a delegate layer, you should never set to view another CALayer object as a delegate. In addition, you should never change the delegate of this layer.
This means that for the UIView layer, you will process the delegate method in UIView in almost all cases, so the level that was passed to this method will be the view level. Sublayers can have anything as their delegate, because they are not tied to a particular kind.
source share