quadCurve ( ) drawRect, , touchhesBegan . , setNeedsDisplay
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
controlPoint = [[touches anyObject] locationInView:self];
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
CGContextSetLineWidth(context, 1.0);
CGContextMoveToPoint(context, 0, 320);
CGContextAddQuadCurveToPoint(context, controlPoint.x, controlPoint.y, 320, 200);
CGContextStrokePath(context);
}
, touch ... e