UIImage GetTintedImage(UIImage img)
        {
            //// Make sure tintColor is available (>= iOS 7.0 runtime)
            //if( [self respondsToSelector:@selector(tintColor)] && img.renderingMode == UIImageRenderingModeAlwaysTemplate )
            //{
            UIGraphics.BeginImageContextWithOptions(img.Size, false, UIScreen.MainScreen.Scale);
            var context = UIGraphics.GetCurrentContext();

            context.TranslateCTM(0, img.Size.Height);
            context.ScaleCTM((nfloat)1.0, (nfloat)(-1.0));
            var rect = new CGRect(0, 0, img.Size.Width, img.Size.Height);

            // draw alpha-mask
            context.SetBlendMode(CGBlendMode.Normal);
            context.DrawImage(rect, img.CGImage);
            // draw tint color, preserving alpha values of original image
            context.SetBlendMode(CGBlendMode.SourceIn);
            TintColor.SetFill();
            context.FillRect(rect);

            var tintedImage = UIGraphics.GetImageFromCurrentImageContext();

            UIGraphics.EndImageContext();
            //}
            return(tintedImage);
        }
            public override void Draw(CGRect rect)
            {
                //get graphics context
                using (CGContext g = UIGraphics.GetCurrentContext())
                {
                    //set up drawing attributes
                    g.SetLineWidth(1);
                    if (TintColor != null)
                    {
                        TintColor.SetFill();
                        TintColor.SetStroke();
                    }
                    else
                    {
                        UIColor.Black.SetFill();
                        UIColor.Black.SetStroke();
                    }

                    //create geometry
                    var path = new CGPath();

                    path.AddLines(new CGPoint[] {
                        new CGPoint(1, 30),
                        new CGPoint(5, 30),
                        new CGPoint(5, 26)
                    });

                    path.CloseSubpath();

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

                base.Draw(rect);
            }