29,044
社区成员
发帖
与我相关
我的任务
分享float dashPhase = 0.0;
float dashLengths[] = {30, 30};
CGContextSetLineDash(context, dashPhase, dashLengths, 20.0);
self.previousPoint2 = self.previousPoint1;
self.previousPoint1 = previous;
self.currentPoint = current;
self.mid1 = [self pointBetween:self.previousPoint1 andPoint:self.previousPoint2];
self.mid2 = [self pointBetween:self.currentPoint andPoint:self.previousPoint1];
UIBezierPath* newPath = [UIBezierPath bezierPath];
[newPath moveToPoint:self.mid1];
[newPath addLineToPoint:self.mid2];
[newPath setLineWidth:self.brushSize];
自己顶起来
可能我描述的不太准确。是这样,如果是画一条点到点的直线,出现虚线是没问题的。可是如果做成画笔效果,把手指在屏幕上的轨迹用虚线画出来,那么当手指滑动的慢的时候,画出来的就是实线了,手指滑动地快才有虚线。
请教大神指导啊!