Subclassing and overriding UITextField in Monotouch

牧云@^-^@ 提交于 2019-12-01 17:44:30

The original ObjC code does not call super (it's base method) but drawInRect:. Have you tried the same with MonoTouch ? e.g.

public override void DrawPlaceholder (RectangleF rect)
{
    using (UIFont font = UIFont.SystemFontOfSize (16))
    using (UIColor col = new UIColor (0,0,255.0,0.7)) {
        col.SetFill ();
        base.DrawString (rect, font);
    }
}

Note: drawInRect:WithFont: maps to the DrawString extension method in C# (which can be called on any string).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!