borders.
This commit is contained in:
parent
b032e40400
commit
5f8780614f
@ -8,7 +8,9 @@
|
||||
|
||||
import MVMCore
|
||||
|
||||
|
||||
/**
|
||||
This class expects its height and width to be equal.
|
||||
*/
|
||||
@objcMembers open class Checkbox: UIControl, MVMCoreViewProtocol, MVMCoreUIMoleculeViewProtocol, MVMCoreUIViewConstrainingProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
@ -41,23 +43,8 @@ import MVMCore
|
||||
|
||||
public var lineWidth: CGFloat = 2
|
||||
public var lineColor: UIColor = .black
|
||||
|
||||
open var borderColor: UIColor {
|
||||
get {
|
||||
guard let color = layer.borderColor else { return .black }
|
||||
return UIColor(cgColor: color)
|
||||
}
|
||||
set (newColor) {
|
||||
layer.borderColor = newColor.cgColor
|
||||
}
|
||||
}
|
||||
|
||||
open var borderWidth: CGFloat {
|
||||
get { return layer.borderWidth }
|
||||
set (newWidth) {
|
||||
layer.borderWidth = newWidth
|
||||
}
|
||||
}
|
||||
public var borderColor: UIColor = .black
|
||||
public var borderWidth: CGFloat = 1
|
||||
|
||||
override open var isSelected: Bool {
|
||||
didSet {
|
||||
@ -141,15 +128,15 @@ import MVMCore
|
||||
super.layoutSubviews()
|
||||
drawCheck()
|
||||
layer.cornerRadius = hasRoundedCorners ? cornerRadiusValue : 0
|
||||
backgroundColor = unCheckedBackgroundColor ?? .white
|
||||
backgroundColor = unCheckedBackgroundColor
|
||||
layer.borderWidth = borderWidth
|
||||
layer.borderColor = borderColor.cgColor
|
||||
}
|
||||
|
||||
public func setupView() {
|
||||
|
||||
isUserInteractionEnabled = true
|
||||
translatesAutoresizingMaskIntoConstraints = false
|
||||
layer.borderWidth = 1
|
||||
layer.borderColor = UIColor.black.cgColor
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user