我正在尝试创建一个简单的绘画应用程序。
- (void)handleSingleTapUIPanGestureRecognizer *)recognizer
{
CGPoint location = [recognizer locationInView:[recognizer.view superview]];
NSLog(@"Test");
CGFloat ok = 40;
self.sheet.test = ok;
[self.sheet addPoint: location];
//Do stuff here...
}
这个函数画线但是当我抬起手指并替换它时,从最后一个点到下一个点有一条“直线”。我怎样才能跳过这个?
Best Answer-推荐答案 strong>
尝试使用 UIGestureRecognizerStateEnded 控制它
if(recognizer.state == UIGestureRecognizerStateEnded){
//Drawing Ends.
isDrawn = NO;
}
根据您的评论,我了解到您正在使用变量 isDrawn 控制您的线条绘制方法。
if(recognier.state == UIGestureStateBegan){
[self moveToPoint:point]; // declare the point variable in the header file.
isDrawn = YES;
//Drawing Starts
}
关于ios - 创建一个 ios 绘画应用程序,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/47067698/
|