I just wrote some code that seems to work. I've added an NSMutableArray
property called circles
to the view, which contains a UIBezierPath
for each circle.
In -awakeFromNib
I setup the array and set self.multipleTouchEnabled = YES
- (I think you did this using a reference to the view in your appDelegate.m).
In the view I call this method in the -touchesBegan
and -touchesMoved
methods.
-(void)setCircles:(NSSet*)touches
{
[_circles removeAllObjects]; //clear circles from previous touch
for(UITouch *t in touches)
{
CGPoint pt= [t locationInView:self];
CGFloat circSize = 200; //or whatever you need
pt = CGPointMake(pt.x - circSize/2.0, pt.y - circSize/2.0);
CGRect circOutline = CGRectMake(pt.x, pt.y, circSize, circSize);
UIBezierPath *circle = [UIBezierPath bezierPathWithOvalInRect:circOutline];
[_circles addObject:circle];
}
[self setNeedsDisplay];
}
Touches ended is:
-(void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
[_circles removeAllObjects];
[self setNeedsDisplay];
}
Then I loop over circles
in -drawRect
and call [circle stroke]
on each one