updated to place border with an offset
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
4c9c07d75f
commit
a1d25b0dfc
@ -191,7 +191,7 @@ extension CALayer {
|
|||||||
|
|
||||||
extension UIView {
|
extension UIView {
|
||||||
|
|
||||||
public func addBorder(side: UIRectEdge, width: CGFloat, color: UIColor) {
|
public func addBorder(side: UIRectEdge, width: CGFloat, color: UIColor, offset: CGFloat = 0) {
|
||||||
let layerName = borderLayerName(for: side)
|
let layerName = borderLayerName(for: side)
|
||||||
layer.remove(layerName: layerName)
|
layer.remove(layerName: layerName)
|
||||||
|
|
||||||
@ -203,11 +203,11 @@ extension UIView {
|
|||||||
case .left:
|
case .left:
|
||||||
borderLayer.frame = CGRect(x: 0, y: 0, width: width, height: frame.height)
|
borderLayer.frame = CGRect(x: 0, y: 0, width: width, height: frame.height)
|
||||||
case .right:
|
case .right:
|
||||||
borderLayer.frame = CGRect(x: frame.width - width, y: 0, width: width, height: frame.height)
|
borderLayer.frame = CGRect(x: frame.width - width - offset, y: 0, width: width, height: frame.height)
|
||||||
case .top:
|
case .top:
|
||||||
borderLayer.frame = CGRect(x: 0, y: 0, width: frame.width, height: width)
|
borderLayer.frame = CGRect(x: 0, y: 0, width: frame.width, height: width)
|
||||||
case .bottom:
|
case .bottom:
|
||||||
borderLayer.frame = CGRect(x: 0, y: frame.height - width, width: frame.width, height: width)
|
borderLayer.frame = CGRect(x: 0, y: frame.height - width - offset, width: frame.width, height: width)
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user