|
@@ -32,7 +32,7 @@ import Foundation
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @IBInspectable var borderWidth: CGFloat = 5 {
|
|
|
|
|
|
+ @IBInspectable var borderWidth: CGFloat = 1 {
|
|
didSet{
|
|
didSet{
|
|
layoutSubviews()
|
|
layoutSubviews()
|
|
}
|
|
}
|
|
@@ -58,26 +58,9 @@ import Foundation
|
|
super.init(frame: frame)
|
|
super.init(frame: frame)
|
|
}
|
|
}
|
|
|
|
|
|
- @objc init(image: UIImage?, borderColor: UIColor, borderWidth: CGFloat) {
|
|
|
|
- super.init(image: image)
|
|
|
|
-
|
|
|
|
- self.borderColor = borderColor
|
|
|
|
- self.borderWidth = borderWidth
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
override func layoutSubviews() {
|
|
override func layoutSubviews() {
|
|
super.layoutSubviews()
|
|
super.layoutSubviews()
|
|
|
|
|
|
- layer.cornerRadius = bounds.width / roundness
|
|
|
|
- layer.borderWidth = borderWidth
|
|
|
|
- layer.borderColor = borderColor.cgColor
|
|
|
|
- layer.backgroundColor = background.cgColor
|
|
|
|
- clipsToBounds = true
|
|
|
|
-
|
|
|
|
- let path = UIBezierPath(roundedRect: bounds.insetBy(dx: 0.5, dy: 0.5), cornerRadius: bounds.width / roundness)
|
|
|
|
- let mask = CAShapeLayer()
|
|
|
|
-
|
|
|
|
- mask.path = path.cgPath
|
|
|
|
- layer.mask = mask
|
|
|
|
|
|
+ self.avatar(roundness: roundness, borderWidth: borderWidth, borderColor: borderColor, backgroundColor: background)
|
|
}
|
|
}
|
|
}
|
|
}
|