Search code examples
iphoneobjective-ciosquartz-2dcgcontext

iOS drawing on command Quartz 2D CGContext


Hi I've made a custom view which represents a graph with axises etc so I'm drawing lots of lines using Quartz 2D in the view's drawRect: method.

However I'd like to change this now so I can use my view's controller to draw specific parts of the graph separately. Eg draw the x-axis wait 10 seconds then draw the y-axis. So I've separated the drawing commands and placed them into separate methods so they can be called from the controller but now since I'm drawing outside drawRect: I can't get a graphics context.

How should I go about implementing this? is quartz 2d even the right thing to use?


Solution

  • You could separate the drawRect: functionality into multiple UIView's, and have the view controller manage which views will draw at a given time