The learning curve for iPhone development has been less steep than I expected. After following some tutorials and the excellent book "Beginning iPhone 3 Development" by Apress things have gone quite ok. And of course when I got stuck this forum has been a great help so far. Until now I never did any 'graphical' programming on any platform I worked on in the past so this is highly uncharted territory for me in general en on the iPhone specific. I haven't been able to find a great source for info yet so I hope that some here can either help me directly or pinpoint me to a source (book, site) with the walhalla of drawing ;)
What I want to make is a gantt chart like drawing. The blocks should have some text on it explaining what that block is about and a button (custom shape eg a star) where the user can tap on. The button needs to change color when it's toggled.
What I've been able to find and try out is: create a separate view, and then implement this code on that view:
- (void)drawRect:(CGRect)rect {
//Get the CGContext from this view
CGContextRef context = UIGraphicsGetCurrentContext();
//Draw it
CGContextStrokePath(context);
//Draw a rectangle
CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
//Define a rectangle
CGContextAddRect(context, CGRectMake(40.0, 10.0, 100.0, 60.0));
//Draw it
CGContextFillPath(context);
}
So far so good but I'm stuck now. My problems are:
the (0,0) coordinates are top left in portrait mode, but my chart needs to be viewed in landscape mode, and converting everything isn't that easy afaik, so I was wondering if I can change the coordinate system.
How do I draw text in that rectangle
How do I know the rectangle is big enough for my text
How do I create a functioning button in that rectangle
Less important but while I'm asking... How do I draw a more fancy block in the chart. The current block is just a plain flat color, but it would be nice to draw a block a bit more iCal-like (with gradients).
a big TIA !!!