在MonoTouch中我试图设置边框颜色,但BorderColor由于其保护级别而无法访问,无法更改。
public class BorderedUITextView:UITextView
{
public BorderedUITextView (RectangleF Frame):base(Frame)
{
this.Layer.BorderColor (UIColor.Black); ????????????
this.Layer.BorderWidth = 1.3f;
this.Layer.CornerRadius = 15f;
this.ClipsToBounds = true;
}
}
答案 0 :(得分:9)
你也可以从UiColor获得CGColor
this.Layer.BorderColor = UIColor.Black.CGColor;
答案 1 :(得分:6)
Layer
(如果CoreAnimation.CALayer
)BorderColor
是属性(不是方法),则应将其指定为:
this.Layer.BorderColor = x;
它也是CGColor
而不是UIColor
this.Layer.BorderColor = new MonoTouch.CoreGraphics.CGColor (0.5f, 0.5f);