Simple Draw an arc problem

Discussion in 'iPhone/iPad Programming' started by oceandrive, Dec 19, 2008.

  1. macrumors newbie

    Joined:
    Nov 17, 2008
    #1
    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.
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    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
     
  3. thread starter macrumors newbie

    Joined:
    Nov 17, 2008
    #3
    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.
     
  4. thread starter macrumors newbie

    Joined:
    Nov 17, 2008
    #4
    issues fixed. had to delete an extra view on my Mainview.
     

Share This Page