Q:

Creating a window graphics context for a CGLayer in iOS outside drawRect: of UIView

UIView creates a window graphics context before a custom drawRect: method is invoked, so inside the method I can get the graphics context.  However, it seems that the only way to get a window graphics context in iOS, so I can make a CGLayer object based on a window graphics context only in a custom drawRect: method of a UIView object.  
However, I might want a model object to contain a CGLayer object, which is created with the model object itself, and later a lot of views use the layer to draw its content on their own views.  One might create a bitmap graphics context to create a CGLayer, but then everything drawn on the screen using the CGLayer object will have characteristics of a bitmap context, as Apple's documents say that drawing with a CGLayer object is restricted to the type of the graphics context used to create the layer. 
So my question is, is it really impossible to create a window graphics context outside drawRect: to make a CGLayer object based on it.  Or, is there a better way to create and store a CGLayer object for on-screen drawing that may be shared by multiple views?  Or is it a completely bogus idea to have such a shared CGLayer object outside a UIView object for a reason I don't realize? 

A:

Yes, you can create a drawing context for a CALayer from a bitmap. 
But the contents of a CGLayer needs a backing bitmap, since it does not save the symbolic (resolution independent) drawing vectors when drawn into, only the resulting pixels.   So either you create the backing bitmap, or you use the one handed you by a UIView, or you recreate/redraw the bits from your own command list when required.