标签:
using System;
using UIKit;
using Foundation;
using CoreGraphics;
namespace GraphicsAnimation
{
public class DrawnImageView : UIView
{
public DrawnImageView ()
{
BackgroundColor = UIColor.White;
}
public override void Draw(CGRect rect)
{
base.Draw (rect);
using(var g=UIGraphics.GetCurrentContext())
{
g.ScaleCTM (1,-1);//画出来的图像默认是倒立的
g.TranslateCTM (0,-Bounds.Height);
g.DrawImage (rect,UIImage.FromFile("MyImage.png").CGImage);
float fontSize = 35f;
g.TranslateCTM (0,fontSize);
g.SetLineWidth (1.0f);
g.SetStrokeColor (UIColor.Yellow.CGColor);
g.SetFillColor (UIColor.Red.CGColor);
//g.SetShadow (new SizeF (5, 5), 0, UIColor.Blue.CGColor);
g.SetShadow(new CGSize(5,5),0,UIColor.Blue.CGColor);
g.SetTextDrawingMode (CGTextDrawingMode.FillStroke);
g.SelectFont ("Helvetica", fontSize, CGTextEncoding.MacRoman);
// show the text
g.ShowText ("Hello Core Graphics");
}
}
}
}
————————————————
标签:
原文地址:http://www.cnblogs.com/bubugao/p/4483285.html