1
我用下面的代码在Swift 3.0中无济于事 - 它给了我一个模拟器上的空白屏幕 - 我不知道发生了什么。在swift中画线3.0
import UIKit
class DrawExample: UIView {
override func draw(_ rect: CGRect) {
let context = UIGraphicsGetCurrentContext()
context!.setLineWidth(3.0)
context!.setStrokeColor(UIColor.purple.cgColor)
//make and invisible path first then we fill it in
context!.move(to: CGPoint(x: 50, y: 60))
context!.addLine(to: CGPoint(x: 250, y:320))
context!.strokePath()
}
的可能的复制[如何绘制在夫特3的线(https://stackoverflow.com/questions/40556112/how-to-draw-a-line-in-swift-3) – Krunal