Drawing simple graphics on iPhone

Does anyone know any existing code that will draw a graph for my iPhone application? I just need a simple line chart with no labels or caption for the data or even an axis.

Or does anyone have ideas on where to start so I can learn to draw such a thing? I have never done real graphics for the iPhone. All my applications are just an image based so far.

Thanks!

+7
source share
2 answers

If you try to draw yourself, you should use Path functions to draw in context in Quartz

CGContextBeginPath(context); CGContextMoveToPoint(context, startX, startY); CGContextAddLineToPoint(context, nextX, nextY); // [...] and so on, for all line segments CGContextSetLineWidth(context, 2); CGContextSetStrokeColorWithColor(context, [[UIColor blackColor] cgColor]); CGContextStrokePath(context); 

There are many code examples for handling context and drawing in quartz.

But there are probably some libraries to make it easier to draw graphs ... someone else would have to help you with this, not a cup of tea :)

+8
source

Try creating a basic framework http://code.google.com/p/core-plot/

+10
source

All Articles