Dibujo con los dedos en la aplicación Xamarin.iOS (C #)

Hago una aplicación donde el usuario puede dibujar algo con sus dedos ... No tengo idea de cómo puedo hacer esto ...

Después de la investigación encontré el código a continuación.

Pero con este código solo puedo dibujar una línea. Si el toque finaliza y comienza un nuevo evento táctil, la línea continúa en este punto ... La línea anterior se conecta automáticamente con la nueva.

Así que quiero crear una nueva línea en cada toque.

¿Alguien sabe cómo funciona esto?

código

    CGPath path;
    CGPoint initialPoint;
    CGPoint latestPoint;

    public DrawView (IntPtr handle) : base (handle)
    {
        BackgroundColor = UIColor.White;

        path = new CGPath();
    }

    public override void TouchesBegan(NSSet touches, UIEvent evt)
    {
        base.TouchesBegan(touches, evt);

        UITouch touch = touches.AnyObject as UITouch;

        if (touch != null)
        {
            initialPoint = touch.LocationInView(this);
        }
    }

    public override void TouchesMoved(NSSet touches, UIEvent evt)
    {
        base.TouchesMoved(touches, evt);

        UITouch touch = touches.AnyObject as UITouch;

        if (touch != null)
        {
            latestPoint = touch.LocationInView(this);
            SetNeedsDisplay();
        }
    }

    public override void Draw(CGRect rect)
    {
        base.Draw(rect);

        if (!initialPoint.IsEmpty)
        {

            //get graphics context
            using (CGContext g = UIGraphics.GetCurrentContext())
            {
                //set up drawing attributes
                g.SetLineWidth(2);
                UIColor.Black.SetStroke();

                //add lines to the touch points
                if (path.IsEmpty)
                {
                    path.AddLines(new CGPoint[] { initialPoint, latestPoint });
                }
                else
                {
                    path.AddLineToPoint(latestPoint);
                }

                //add geometry to graphics context and draw it
                g.AddPath(path);

                g.DrawPath(CGPathDrawingMode.Stroke);
            }
        }
    }

Respuestas a la pregunta(1)

Su respuesta a la pregunta