views:

52

answers:

1

Is there some way I can do something like:

@implementation MyView

- (void)drawRect:(CGRect)rect
{
   // Get the thing I'm supposed to draw (CGImageRef, pattern, etc.) and draw it
   // i.e. not real code
   CGContextDrawWhatever(self.objectThatHoldsDrawing.drawing);
}
+1  A: 

Have a look at CGPathRef, CGLayer (or maybe even just CALayer, but that's mostly equivalent to a drawRect: method) and rendering (e.g. buffering) to image context and just renderind the image.

MrMage
Thanks for the response, I was thinking of something liek that. Can you give me an example with CGLayer?
DevDevDev
Have a look at http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_layers/dq_layers.html
MrMage