make.appアプリ開発Tips - メモ
手書きメモの一部

    CGPoint currentPoint = [[touches anyObject] locationInView:self.canvasView];
    CGPoint prevPoint = [[touches anyObject] previousLocationInView:self.canvasView];
    
    UIGraphicsBeginImageContext(self.canvasView.frame.size);
    [self.canvasView.image drawInRect:CGRectMake(0, 0, self.canvasView.frame.size.width, self.canvasView.frame.size.height)];
    CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);  // 太さ
    CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.0, 0.0, 1.0);  // 線の色
    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);  // 線の角を丸く
    CGContextMoveToPoint(UIGraphicsGetCurrentContext(), prevPoint.x, prevPoint.y);  // ここから
    CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);  // ここへ
    CGContextStrokePath(UIGraphicsGetCurrentContext());
    
    self.canvasView.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();