public override void TouchesEnded(NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); foreach (UITouch touch in touches.Cast <UITouch>()) { // Get polyline from dictionary and remove it from dictionary FingerPaintPolyline polyline = inProgressPolylines[touch.Handle]; inProgressPolylines.Remove(touch.Handle); // Add final point to path and save with completed polylines polyline.Path.AddLineToPoint(touch.LocationInView(this)); completedPolylines.Add(polyline); } SetNeedsDisplay(); }
public override void TouchesBegan(NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); foreach (UITouch touch in touches.Cast <UITouch>()) { // Create a FingerPaintPolyline, set the initial point, and store it FingerPaintPolyline polyline = new FingerPaintPolyline { Color = StrokeColor, StrokeWidth = StrokeWidth, StrokeAlpha = 0.3f }; polyline.Path.MoveToPoint(touch.LocationInView(this)); inProgressPolylines.Add(touch.Handle, polyline); } SetNeedsDisplay(); }