Q: Best practices drawing onto a very large graphics context I need to draw onto a very, very wide context (possibly going into the 100,000's of pixels in width)
The stuff that I am drawing is simple (exclusively lines, ellipses and arcs).
Currently, I am using a tiling mechanism to render pieces of this image as SVG graphics in UIWebViews sitting in a UIScrollView. Horrible, I know. Performance is so bad it makes me want to hurt myself.
So I'm left with no choice but to draw things directly in Quartz. The problem is that I couldn't find any good information on handling such a large drawing.
The commands will be stored in a array (i.e [0] - line from x1,x2 to y1,2 [2] - arc at x1,x2,h,v etc...) which makes it possible to immediately determine what needs to be drawn at any point of time.
How should I best go about handling the actual drawing? Make a ginormous context then draw onto it, erasing the parts that go off screen? Can I draw straight into the UIScrollView?
Or am I supposed to performing some sort of tiling? Creating smaller views and drawing on them?

A: Look into CATiledLayer. It supports huge dimensions, yet only draws "tiles" that are visible. This means that in your drawLayer:inContext: you need to calculate how to draw the tile you were asked to draw. That might be quite complicated to implement but the performance boost makes up for this. I use this to draw a "strip" that is often over 20.000 pixels wide, tiled into 256 pixel pieces (this is the default).
You not only want this because of speed but also due to memory: if you really had a view or layer that were that big it would take up immense amounts of memory. Tiling is the only solution here.
See this nice article by Michael Heyeck on how to use CATiledLayer (Apple has a demo as well, but I think the linked article is better).

A: If the stuff you are drawing is not static then using CATiledLayer(s) doesn't work very well.  A better solution is presented partly in http://www.mlsite.net/blog/?p=1342 .  I've used this as a basis from some interactive drawing.  A little slow but I'm still optimizing.  Use http://red-glasses.com/index.php/tutorials/catiledlayer-how-to-use-it-how-it-works-what-it-does/ as a check list of whether you should use CATiledLayer(s) or not.
