Label设置边框线

func setBorder(_ color: UIColor, _ width: CGFloat, _ cornerRadius: CGFloat)  {
        self.layer.cornerRadius = cornerRadius
        var frame = self.frame
        frame.size.width += 10
        frame.size.height = 20
        self.frame = frame
        self.layer.borderColor = color.cgColor
        self.layer.borderWidth = width
        self.layer.masksToBounds = true
  }

你可能感兴趣的:(Label设置边框线)