Ios 粗线或细线根据触摸而定

Ios 粗线或细线根据触摸而定,ios,core-graphics,draw,Ios,Core Graphics,Draw,我在应用程序中使用核心图形进行绘图 我想根据触摸速度画一条粗线或细线 我已经编写了以下代码来绘制粗线或细线 在年,我能够使用PangestureRecognitor跟踪速度,并将其应用于线宽,因此我能够根据触摸的速度绘制粗细线条 但主要的问题是画的线看起来不是很平滑 所以,如果我能在平滑的曲线上画出成功的粗线或细线,那就太棒了 - (void)handlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer { if (pa

我在应用程序中使用核心图形进行绘图

我想根据触摸速度画一条粗线或细线

我已经编写了以下代码来绘制粗线或细线

在年,我能够使用PangestureRecognitor跟踪速度,并将其应用于线宽,因此我能够根据触摸的速度绘制粗细线条

但主要的问题是画的线看起来不是很平滑

所以,如果我能在平滑的曲线上画出成功的粗线或细线,那就太棒了

- (void)handlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer
{

    if (panGestureRecognizer.state == UIGestureRecognizerStateBegan)
    {



        // retrieve touch point
        currentPoint = [panGestureRecognizer locationInView:panGestureRecognizer.view];

        previousPoint = currentPoint;



    }

    if (panGestureRecognizer.state == UIGestureRecognizerStateChanged)
    {

        currentPoint = [panGestureRecognizer locationInView:panGestureRecognizer.view];


        previousPoint = currentPoint; 

        float vel = [self ccpLength:[panGestureRecognizer velocityInView:panGestureRecognizer.view]];

        tmplinewidth    =   vel /   166.0f;

        tmplinewidth    =   clampf(tmplinewidth, 2, 20);


    }

    if (panGestureRecognizer.state == UIGestureRecognizerStateEnded)
    {

    }
}