title: How can I use Core Graphics to draw a circle at my touch location?
body: <p>New programmer here. I am having issues trying to use Core Graphics to draw a stroked arc around my touch location. I have the method to draw the circle working fine, and I have tested and am registering touches when I tap the screen, but when I try to call the method to draw the circle when I tap, I get the error "CGContextBlahBlah: invalid context 0x0"</p>
  
  <p>I <em>think</em> that this is because I'm not calling the method in drawRect:().</p>
  
  <p>So how am I able to call this method on a touch? Furthermore, how can I use the "CGPoint locationOfTouch" as a parameter in my draw method?</p>
  
  <p>Here are the code chunks I am working with.</p>
  
  <pre><code>-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  {
      UITouch *touch = [touches anyObject];
      CGPoint locationOfTouch = [touch locationInView:self];
      [self drawTouchCircle:(locationOfTouch)];
      [self setNeedsDisplay];
  }
  
  
  -(void)drawTouchCircle:(CGPoint)locationOfTouch
  {
      CGContextRef ctx= UIGraphicsGetCurrentContext();
  
      CGContextSaveGState(ctx);
  
      CGContextSetLineWidth(ctx,5);
      CGContextSetRGBStrokeColor(ctx,0.8,0.8,0.8,1.0);
      CGContextAddArc(ctx,locationOfTouch.x,locationOfTouch.y,30,0.0,M_PI*2,YES);
      CGContextStrokePath(ctx);
  }
  </code></pre>
  
  <p>Thanks in advance for the help!</p>