public static void DrawRoundedLine(CGContext context, List<PointF> points, CGColor color, float lineWidth, bool closePath, bool dashed) { if (points == null) throw new NullReferenceException(); if (points.Count == 0) throw new ArgumentException("The line must have at least one point."); context.SaveState(); context.SetStrokeColor(color); context.SetLineWidth(lineWidth); context.SetLineCap(CGLineCap.Round); context.SetLineJoin(CGLineJoin.Round); context.MoveTo(points[0].X, points[0].Y); for(int a = 1; a < points.Count; a++) context.AddLineToPoint(points[a].X, points[a].Y); if (dashed) context.SetLineDash(0, new float[2] { 1, 2 }, 2); if (closePath) context.ClosePath(); context.StrokePath(); context.RestoreState(); }