我正在尝试在自定义单元格中为UIView添加边框。我在尝试:
partial class EventCell : UITableViewCell
{
public EventCell (IntPtr handle) : base (handle)
{
}
public void SetUpCell(Event eventObj)
{
title.Text = eventObj.title;
cellFooter.Layer.BorderColor = new MonoTouch.CoreGraphics.CGColor (224f, 224f, 224f);
cellFooter.Layer.BorderWidth = 5.0f;
cellFooter.Layer.MasksToBounds = true;
}
}
任何想法?
答案 0 :(得分:2)
使用cellFooter.Layer.BorderColor = UIColor.FromRGB(224,224,224).CGColor;
代替创建新的CGcolor修复它。
答案 1 :(得分:0)
添加' clipsToBounds'财产如下
cellFooter.layer.borderWidth = 5.0f;
cellFooter.layer.borderColor = [UIColor blueColor].CGColor;
cellFooter.clipsToBounds= YES;
答案 2 :(得分:0)
我只是在函数drawRect中修复它,然后填充此代码
cellFooter.layer.borderWidth = 5.0f;
cellFooter.layer.borderColor = [UIColor blueColor].CGColor;
答案 3 :(得分:-1)
您需要使用视图的图层来设置border属性。 e.g:
...
view.layer.borderColor = [UIColor redColor].CGColor;
view.layer.borderWidth = 3.0f;
您还需要与QuartzCore.framework链接才能访问此功能。