setting up the rest.

This commit is contained in:
Kevin G Christiano 2019-10-02 15:27:32 -04:00
parent 77a3eb8827
commit 61fcd981c1

View File

@ -72,15 +72,6 @@
checkboxHeightConstraint?.isActive = true
alignSubviews(by: .centerLeft)
label.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(tapped))
tap.numberOfTapsRequired = 1
label.addGestureRecognizer(tap)
}
@objc func tapped() {
checkbox.updateSelection(to: !checkbox.isSelected, animated: true)
}
//--------------------------------------------------
@ -104,25 +95,10 @@
public convenience init(position: CheckboxPosition) {
self.init(frame: .zero)
toggleSubviewConstraints(isActive: false)
alignSubviews(by: position)
}
public convenience init(checkedColor: UIColor, unCheckedColor: UIColor, text: String?, isChecked: Bool = false) {
self.init(frame: .zero)
checkbox.checkedBackgroundColor = checkedColor
checkbox.unCheckedBackgroundColor = unCheckedColor
label.text = text
}
public convenience init(checkedColor: UIColor, unCheck unCheckedColor: UIColor, attributedText: NSAttributedString, isChecked: Bool = false) {
self.init(frame: .zero)
checkbox.checkedBackgroundColor = checkedColor
checkbox.unCheckedBackgroundColor = unCheckedColor
label.attributedText = attributedText
}
//--------------------------------------------------
// MARK: - Methods
//--------------------------------------------------
@ -211,6 +187,7 @@ extension CheckboxWithLabelView {
}
@objc override open func updateView(_ size: CGFloat) {
super.updateView(size)
label.updateView(size)