Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

oceandrive

macrumors newbie
Original poster
Nov 17, 2008
28
0
Case:

Created an view based application in the Xcode and created a new View called chartView:UIView and mapped the controller using the IB .

I wanted to draw a simple arc on my ChartView . So inside my drawRect method I put the code for the arc.

CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0);
CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1.0);
CGContextSetLineWidth(context, 2.0);
int x = 150;
int y= 100;
int r= 80;
CGContextSetRGBFillColor(context, 0, 1, 0, 1);
CGContextMoveToPoint(context, x, y);
CGContextAddArc(context,x , y, r, 0.0*M_PI/180.0, 90.0*M_PI/180.0, 0);
CGContextClosePath(context);
CGContextFillPath(context);

I see an empty screen when I start my application.

Can someone tell me if I am missing any step. Thanks For the help.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Start off with something basic, like filling a rect. If that works, go from there and try a basic arc. Also use positions relative to the view, using things like CGRectGetMinX instead of 0
 

oceandrive

macrumors newbie
Original poster
Nov 17, 2008
28
0
I started of with the QuartzDemo example and was able to draw the arc (in fact the complete pie chart) successfully. But once I strarted to draw the arc on the project which I created I am having the problem. Nothing shows on the screen.

But when I drag and drop a text field or a label using the interface builder, I can see them on the simulator.

Thanks for the help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.