实现xuextension UIView{
func drawBoardDottedLine(width:CGFloat,length:CGFloat,space:CGFloat,cornerRadius:CGFloat,color:UIColor){
self.layer.cornerRadius = cornerRadius
let borderLayer = CAShapeLayer()
borderLayer.bounds = self.bounds
borderLayer.position = CGPoint(x: self.bounds.midX, y: self.bounds.midY);
borderLayer.path = UIBezierPath(roundedRect: borderLayer.bounds, cornerRadius: cornerRadius).cgPath
borderLayer.lineWidth = width / UIScreen.main.scale
borderLayer.lineDashPattern = [length,space] as [NSNumber]?
borderLayer.lineDashPhase = 0.1
borderLayer.fillColor = UIColor.clear.cgColor
borderLayer.strokeColor = color.cgColor
self.layer.addSublayer(borderLayer)
}
}