I just updated to xcode 4 and I'm already having trouble simply drawing a small circle wherever the screen is tapped. I keep getting an invalid context error and I'm stumped. Any help is appreciated!
Code:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint point1 = [touch locationInView:self.view];
[self.view setNeedsDisplay];
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect theRect = CGRectMake(point1.x, point1.y, 50, 50);
CGContextFillEllipseInRect(context, theRect);
CGContextSetFillColorWithColor(context, [UIColor blackColor].CGColor);
CGContextDrawPath(context, kCGPathFillStroke);
}