UITextView - 设置边框颜色
问题描述:
在MonoTouch中,我尝试设置边框颜色,但由于其保护级别而无法访问BorderColor,因此无法更改。UITextView - 设置边框颜色
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;
}
}
答
Layer
(如果CoreAnimation.CALayer
)BorderColor
是一个属性(不是法)因此它应该分配这样的:
this.Layer.BorderColor = x;
而且它是一个CGColor
不是UIColor
this.Layer.BorderColor = new MonoTouch.CoreGraphics.CGColor (0.5f, 0.5f);
答
你也可以从UiColor获得CGColor
this.Layer.BorderColor = UIColor.Black.CGColor;
有什么问题? –
“边框颜色设置如何” - 在下面回答 –