在UIView子类中,我重写Draw子来绘制一些自定义文本,但文本allways被绘制为翻转文本。MonoTouch:自定义绘图文本allways绘制翻转文本
这是代码我使用:
class TextViewProblem : UIView
{
public override void Draw (RectangleF rect)
{
base.Draw (rect);
CGContext g = UIGraphics.GetCurrentContext();
UIColor.White.SetFill();
g.SelectFont("Arial",16f,CGTextEncoding.MacRoman);
UIColor.White.SetFill();
g.SetTextDrawingMode(CGTextDrawingMode.Fill);
g.ShowTextAtPoint(1,25,"Yiannis 123");
}
}
这是这段代码的输出:
为什么文本取用翻转?
我运行: 的MonoDevelop 2.4.2 iPhone模拟器4.2 的MonoTouch 3.2.6
你可以下载一个项目,从这个链接重现此问题:www.grbytes.com/downloads/TextProblem.zip
我发现在Draw重写中我可以使用UIView的DrawString方法。它以这种方式绘制文本。 – 2011-10-25 02:20:27