title: Drawing circles in Core Graphics - why isn't this working?
body: <p>I'm trying to create a simple drawing app that creates circles wherever you put your finger, this is what I have:</p>
  
  <pre><code>@synthesize touchPos;
  @synthesize coords;
  
  
  - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  {
      UITouch *touch = [touches anyObject];
      touchPos = [touch locationInView:self.view];
      coords.text = [NSString stringWithFormat:@"%3.0f, %3.0f", touchPos.x, touchPos.y];
      [self setNeedsDisplay];
  }
  
  - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
  {
      [self touchesBegan:touches withEvent:event];
  }
  
  - (void)drawRect:(CGRect)rect
  {
      CGContextRef contextRef = UIGraphicsGetCurrentContext();
      CGContextSetLineWidth(contextRef, 2.0);
      CGContextSetRGBFillColor(contextRef, 0, 0, 1.0, 1.0);
      CGContextSetRGBStrokeColor(contextRef, 0, 0, 1.0, 1.0);
      CGRect circlePoint = (CGRectMake(touchPos.x, touchPos.y, 10.0, 10.0));
  
      CGContextFillEllipseInRect(contextRef, circlePoint);
  }
  </code></pre>
  
  <p>I don't get any errors or warnings, it just doesn't draw anything. Also, the text box shows the coordinates wherever I'm touching, so I know that's not the problem.</p>