static TableViewSectionView () { using (var rgb = MonoTouch.CoreGraphics.CGColorSpace.CreateDeviceRGB()){ float [] colorsBottom = { 1, 1, 1, 0f, 0.4f, 0.4f, 0.4f, .6f }; BottomGradient = new MonoTouch.CoreGraphics.CGGradient (rgb, colorsBottom, null); float [] colorsTop = { 0.8f, 0.8f, 0.8f, .4f, 1, 1, 1, 0f }; TopGradient = new MonoTouch.CoreGraphics.CGGradient (rgb, colorsTop, null); } }
static TableViewSectionView() { using (var rgb = MonoTouch.CoreGraphics.CGColorSpace.CreateDeviceRGB()){ float [] colorsBottom = { 1, 1, 1, 0f, 0.4f, 0.4f, 0.4f, .6f }; BottomGradient = new MonoTouch.CoreGraphics.CGGradient(rgb, colorsBottom, null); float [] colorsTop = { 0.8f, 0.8f, 0.8f, .4f, 1, 1, 1, 0f }; TopGradient = new MonoTouch.CoreGraphics.CGGradient(rgb, colorsTop, null); } }
public override void Draw(System.Drawing.RectangleF rect) { base.Draw(rect); using (MonoTouch.CoreGraphics.CGContext gfx = UIGraphics.GetCurrentContext()) { using (MonoTouch.CoreGraphics.CGColorSpace rgb = MonoTouch.CoreGraphics.CGColorSpace.CreateDeviceRGB()) { MonoTouch.CoreGraphics.CGGradient gradient = new MonoTouch.CoreGraphics.CGGradient(rgb, new MonoTouch.CoreGraphics.CGColor[] { startColor.CGColor, endColor.CGColor }); gfx.DrawLinearGradient(gradient, new System.Drawing.PointF(rect.Left, rect.Top), new System.Drawing.PointF(rect.Right, rect.Top), MonoTouch.CoreGraphics.CGGradientDrawingOptions.DrawsBeforeStartLocation); } } }