【发布时间】:2018-01-10 05:07:08
【问题描述】:
下面的代码在 UIView 上打印一行。我只想知道我将编写的能够在视图顶部插入图像的代码。
import UIKit
class draw: UIView {
var line = UIBezierPath()
var line1 = UIBezierPath()
func grapher() {
line1.move(to: .init(x:0, y: bounds.height / 6))
line1.addLine(to: .init(x: bounds.width, y: bounds.height / 6))
UIColor.blue.setStroke()
line1.lineWidth = 2
line1.stroke()
}
override func draw(_ rect: CGRect) {
grapher()
}
}
【问题讨论】:
-
你可以简单的在视图中添加背景图片,为什么你可以绘制bezierpath?
-
您在寻找
UIImageView?画线和插入图片有什么关系?