Brought back resizing to checkbox.

This commit is contained in:
Kevin G Christiano 2019-12-04 16:25:31 -05:00
parent 9b53f4bac0
commit aaa8e4132e
2 changed files with 10 additions and 4 deletions

View File

@ -16,6 +16,8 @@ import MVMCore
// MARK: - Properties
//--------------------------------------------------
public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: Checkbox.defaultHeightWidth, standardiPadPortraitSize: Checkbox.defaultHeightWidth + 6.0)
// Form Validation
var isRequired = false
var fieldKey: String?
@ -117,8 +119,8 @@ import MVMCore
// MARK: - Constraints
//--------------------------------------------------
private var heightConstraint: NSLayoutConstraint?
private var widthConstraint: NSLayoutConstraint?
public var heightConstraint: NSLayoutConstraint?
public var widthConstraint: NSLayoutConstraint?
/// Updates the height and width anchors of the Checkbox with the assigned value.
public var heigthWidthConstant: CGFloat = Checkbox.defaultHeightWidth {
@ -398,6 +400,11 @@ import MVMCore
public func updateView(_ size: CGFloat) {
if let dimension = sizeObject?.getValueBased(onSize: size) {
widthConstraint?.constant = dimension
heightConstraint?.constant = dimension
}
layoutIfNeeded()
}

View File

@ -19,8 +19,6 @@
// MARK: - Properties
//--------------------------------------------------
public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: Checkbox.defaultHeightWidth, standardiPadPortraitSize: Checkbox.defaultHeightWidth + 6.0)
public var checkboxPosition: CheckboxPosition = .center
public enum CheckboxPosition: String {
@ -139,6 +137,7 @@ extension CheckboxWithLabelView {
super.updateView(size)
label.updateView(size)
checkbox.updateView(size)
layoutIfNeeded()
}