resolvong a constraint issue

This commit is contained in:
Kevin G Christiano 2020-04-20 17:46:50 -04:00
parent 82c7b372c9
commit d8d691f2cc
2 changed files with 5 additions and 8 deletions

View File

@ -135,12 +135,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
knobLeadingConstraint?.isActive = false
knobTrailingConstraint?.isActive = false
if isOn {
constrainKnobOn()
} else {
constrainKnobOff()
}
_ = isOn ? constrainKnobOn() : constrainKnobOff()
knobTrailingConstraint?.isActive = true
knobLeadingConstraint?.isActive = true
@ -242,7 +237,6 @@ public typealias ActionBlockConfirmation = () -> (Bool)
bottomAnchor.constraint(greaterThanOrEqualTo: knobView.bottomAnchor).isActive = true
constrainKnobOff()
knobLeadingConstraint?.isActive = true
}
public override func reset() {

View File

@ -8,6 +8,7 @@
import UIKit
@objcMembers open class LabelToggle: View {
//--------------------------------------------------
// MARK: - Properties
@ -38,7 +39,9 @@ import UIKit
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
guard let model = model as? LabelToggleModel,
let toggleHeight = Toggle.estimatedHeight(with: model.toggle, delegateObject),
let labelHeight = Label.estimatedHeight(with: model.label, delegateObject) else { return nil }
let labelHeight = Label.estimatedHeight(with: model.label, delegateObject)
else { return nil }
return max(toggleHeight, labelHeight)
}