ユーザーが を使用して画面に描いたパスを描画したいUIPanGestureRecognizer
。
次の関数を使用していますが、結果はありません。
どこが間違っているのか教えてください。
- (void)pan:(UIPanGestureRecognizer *)sender{
[[UIColor greenColor]set];
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 1.0f);
if (sender.state==UIGestureRecognizerStateBegan) {
CGContextMoveToPoint(context, [sender locationInView:self.view].x, [sender locationInView:self.view].y);
NSLog(@"touch phase began");
}
CGContextAddLineToPoint(context, [sender locationInView:self.view].x, [sender locationInView:self.view].y);
if (sender.state==UIGestureRecognizerStateEnded)
CGContextStrokePath(context);
}
前もって感謝します