constraint change

This commit is contained in:
Kevin G Christiano 2020-07-15 19:30:35 -04:00
parent d44a193ff0
commit d9b23e4a58
2 changed files with 6 additions and 8 deletions

View File

@ -42,7 +42,6 @@ open class OrderTracker: View {
guard let stepModels = stepModels else { return } guard let stepModels = stepModels else { return }
var anchor = topAnchor var anchor = topAnchor
var previousStep: Step?
for stepModel in stepModels { for stepModel in stepModels {
@ -56,11 +55,10 @@ open class OrderTracker: View {
step.topAnchor.constraint(equalTo: anchor).isActive = true step.topAnchor.constraint(equalTo: anchor).isActive = true
anchor = step.bottomAnchor anchor = step.bottomAnchor
previousStep = step
} }
bottomAnchor.constraint(equalTo: anchor).isActive = true bottomAnchor.constraint(equalTo: anchor).isActive = true
previousStep?.imageBottomConstraint?.constant = 0 (subviews.last as? Step)?.heightConstraint?.isActive = false
} }
func resetSteps() { func resetSteps() {

View File

@ -23,7 +23,7 @@ open class Step: View {
// MARK: - Constraints // MARK: - Constraints
//-------------------------------------------------- //--------------------------------------------------
public var imageBottomConstraint: NSLayoutConstraint? public var heightConstraint: NSLayoutConstraint?
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Computed Properties // MARK: - Computed Properties
@ -71,9 +71,9 @@ open class Step: View {
bodyBottomConstraint.priority = .defaultHigh bodyBottomConstraint.priority = .defaultHigh
bodyBottomConstraint.isActive = true bodyBottomConstraint.isActive = true
let heightConstraint = heightAnchor.constraint(equalToConstant: 58) heightConstraint = heightAnchor.constraint(equalToConstant: 58)
heightConstraint.priority = .defaultLow heightConstraint?.priority = .defaultLow
heightConstraint.isActive = true heightConstraint?.isActive = true
} }
public override func reset() { public override func reset() {
@ -83,7 +83,7 @@ open class Step: View {
bodyTop.reset() bodyTop.reset()
bodyBottom.reset() bodyBottom.reset()
stateImage.reset() stateImage.reset()
imageBottomConstraint?.constant = Padding.Ten heightConstraint?.isActive = true
} }
//------------------------------------------------------ //------------------------------------------------------