我使用以下代码来添加边框UIView
和边框UITableView
。
为UIView
:
RectangleF _frame = new RectangleF (0, 0, this.Frame.Width , 56);
DescriptionView = new UIView (_frame);
DescriptionView.BackgroundColor = UIColor.White ;
DescriptionView.Layer.BorderColor = new CGColor (0, 0, 0, 1.0f);
DescriptionView.Layer.BorderWidth = 0.5f;
对于UITable
:
RectangleF _frame = new RectangleF (0, DescriptionView.Frame.Height + 10,
this.Frame.Width , this.Frame.Height - (DescriptionView.Frame.Height + 10));
InstructionTable = new UITableView (_frame);
InstructionTable.Layer.BorderColor = new CGColor (0, 0, 0, 1.0f);
InstructionTable.Layer.BorderWidth = 0.5f;
对于iPhone 3.5英寸和iPhone 4英寸,它可以正常工作,但对于iPad,边框不会在视图的右侧以及桌子的顶部和右侧显示。请参见下面的屏幕截图:
代替:
DescriptionView.Layer.BorderWidth = 0.5f;
我用刨丝器宽度:
DescriptionView.Layer.BorderWidth = 1f;
它解决了我的问题
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句