public override void DrawInContext(CoreGraphics.CGContext ctx) { base.DrawInContext(ctx); var rect = this.Frame; switch (Type) { case GradientType.Linear: linearGradient.Draw(ctx, rect); break; case GradientType.Radial: radialGradient.Draw(ctx, rect); break; case GradientType.Ellipse: ellipticalGradient.Draw(ctx, rect); break; case GradientType.Multi: multiGradient.Draw(ctx, rect); break; default: throw new NotImplementedException("The target gradient type is not supported: " + Type); } }
public override void Draw(CGRect rect) { base.Draw(rect); using (CGContext ctx = UIGraphics.GetCurrentContext()) { switch (Type) { case GradientType.Linear: linearGradient.Draw(ctx, rect); break; case GradientType.Radial: radialGradient.Draw(ctx, rect); break; case GradientType.Ellipse: ellipticalGradient.Draw(ctx, rect); break; case GradientType.Multi: multiGradient.Draw(ctx, rect); break; default: throw new NotImplementedException("The target gradient type is not supported: " + Type); } } }