2011-10-12 87 views
1

在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; 
    } 
} 
+2

有什么问题? –

+0

“边框颜色设置如何” - 在下面回答 –

回答

6

Layer(如果CoreAnimation.CALayerBorderColor是一个属性(不是法)因此它应该分配这样的:

this.Layer.BorderColor = x; 

而且它是一个CGColor不是UIColor

this.Layer.BorderColor = new MonoTouch.CoreGraphics.CGColor (0.5f, 0.5f); 
7

你也可以从UiColor获得CGColor

this.Layer.BorderColor = UIColor.Black.CGColor;