`

swift -> h画直线

 
阅读更多

 

    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    
        
        let line = CAShapeLayer()
        let linePath = UIBezierPath()
        linePath.move(to: CGPoint(x: 10, y: 10))
        linePath.addLine(to: CGPoint(x: 100, y: 100))
        line.path = linePath.cgPath
        line.strokeColor = UIColor.red.cgColor
        line.lineWidth = 2
        line.lineJoin = kCALineJoinRound
        self.view.layer.addSublayer(line)
        
        
    }

 

结果 效果图

 

 

 

 

  • 大小: 14.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics