Ios 画一条尾巴,就像快捷键键盘一样

Ios 画一条尾巴,就像快捷键键盘一样,ios,drawing,uigraphicscontext,Ios,Drawing,Uigraphicscontext,我想定制键盘。我完成了所有的功能,但刷卡功能无法在我的应用程序中实现。当我在键盘上滑动时,字母输入正确,但线条(绘制)无法完美绘制&我无法删除点的旧路径。因此,请帮助。我需要这种类型的滑动 我写这个代码 - (void)touchesBegan: (NSSet *)touches withEvent: (UIEvent *)event { CGPoint location = [[touches anyObject] locationInView:self]; myPath=nil; [_my

我想定制键盘。我完成了所有的功能,但刷卡功能无法在我的应用程序中实现。当我在键盘上滑动时,字母输入正确,但线条(绘制)无法完美绘制&我无法删除点的旧路径。因此,请帮助。我需要这种类型的滑动

我写这个代码

- (void)touchesBegan: (NSSet *)touches withEvent: (UIEvent *)event {
CGPoint location = [[touches anyObject] locationInView:self];
myPath=nil;
[_myPathArray removeAllObjects];

myPath=[[UIBezierPath alloc]init];
myPath.lineCapStyle=kCGLineCapRound;
myPath.lineWidth=5.0;

_brushPattern=[UIColor redColor];

_myArray=[[NSMutableArray alloc]init];

UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
[myPath moveToPoint:[mytouch locationInView:self]];}

-(void)touchesMoved:(NSSet *)touches withEvent: (UIEvent *)event {
CGPoint location = [[touches anyObject] locationInView:self];
[myPath addLineToPoint:location];
shapeLayer.path = myPath.CGPath;
shapeLayer.strokeColor = _brushPattern.CGColor;
shapeLayer.lineWidth = 3.0;
shapeLayer.fillColor = [[UIColor clearColor] CGColor];
[self.layer addSublayer:shapeLayer];
[self setNeedsDisplay];}
这段代码给出了这个结果。但是我想在一些路径绘制之后删除路径..比如swype keyboard

至少显示您绘制的代码、尝试删除旧路径的位置等。您在哪里删除添加的
CALayer
?我在touchesEnded方法中删除CAShapeLayer。这将删除整个路径,但我只想删除路径的第一个点。@Milanpetel你找到解决方案了吗?不,我没有找到任何解决方案……如果你知道的话,请建议我。谢谢