I use this:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { self.currentPath = [UIBezierPath bezierPath]; currentPath.lineWidth = 3.0; [currentPath moveToPoint:[touch locationInView:self]]; [paths addObject:self.currentPath]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [self.currentPath addLineToPoint:[touch locationInView:self]]; [self setNeedsDisplay]; } - (void)drawRect:(CGRect)rect { [[UIColor redColor] set]; for (UIBezierPath *path in paths) { [path stroke]; } }
You can get a link to the associated class from apple.
source share