CoreGraphics drawing without a UIView subclass -- possible?


For the Gold challenge, I ended up creating a new UIView subclass that draws a crosshair in drawRect, then adding that as the overlayView for the camera. That works perfectly well, but it feels like overkill to create an entire class just to draw two lines on screen.

Is there any way to create a UIView and then draw directly into it? I was imagining something like this…

[code]UIView *overlayView = [[UIView alloc] initWithFrame:[[imagePicker view] bounds]];

CGContextRef context = [overlayView CGContext]; // <-- made up method

// …draw the crosshair here…


[imagePicker setCameraOverlayView:overlayView];[/code]

I can’t find a technique like that in the documentation. Does it exist? I suspect not, but it would be good to confirm that…