Guest User

Untitled

a guest
Mar 22nd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. private func drawDashedLine() {
  2. let shapeLayer = CAShapeLayer()
  3. let bezierPath = UIBezierPath()
  4.  
  5. let pointA = CGPoint(x: self.bounds.minX, y: self.bounds.midY)
  6. let pointB = CGPoint(x: self.bounds.maxX, y: self.bounds.midY)
  7.  
  8. bezierPath.move(to: pointA)
  9. bezierPath.addLine(to: pointB)
  10.  
  11. shapeLayer.fillColor = UIColor.white.cgColor
  12. shapeLayer.strokeColor = UIColor.white.cgColor
  13. shapeLayer.lineWidth = 2.0 / UIScreen.main.scale
  14. shapeLayer.lineJoin = kCALineJoinMiter
  15. shapeLayer.lineDashPattern = [ 6, 3 ]
  16. shapeLayer.path = bezierPath.cgPath
  17. backgroundColor = dashColor
  18. layer.mask = shapeLayer
  19. }
Add Comment
Please, Sign In to add comment