Swift 在上方添加行以进行控制 [英] Swift add line above to control
本文介绍了Swift 在上方添加行以进行控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在下面的屏幕中,我想在 "Item" 标签上方和 "Add" 按钮之后添加水平线(在添加按钮下方,我有动态桌子).UIGraphicsGetCurrentContext()
在这里不起作用.
In the below screen, I want to add horizontal line above to "Item" label and after "Add" button (below to the add button, I have dynamic table). UIGraphicsGetCurrentContext()
doesn't work here.
有人可以帮我怎么做吗?
Can someone help me how to do this?
推荐答案
添加子视图作为一行很简单.例如:
It is simple to add a subview to act as a line. For example:
斯威夫特 4
var lineView = UIView(frame: CGRect(x: 0, y: 100, width: 320, height: 1.0))
lineView.layer.borderWidth = 1.0
lineView.layer.borderColor = UIColor.black.cgColor
self.view.addSubview(lineView)
目标 C
UIView * lineview = [[UIView alloc] initWithFrame:CGRectMake(0, 100,320,1)];
lineview.layer.borderColor = [UIColor blackColor].CGColor;
lineview.layer.borderWidth = 1.0;
[self.view addSubview:lineview];
或者你可以参考这个链接添加CALayer或者绘制一个视图
Or you can refer to this link to add CALayer or draw a view
这篇关于Swift 在上方添加行以进行控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文