在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