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 }
var anchor = topAnchor
var previousStep: Step?
for stepModel in stepModels {
@ -56,11 +55,10 @@ open class OrderTracker: View {
step.topAnchor.constraint(equalTo: anchor).isActive = true
anchor = step.bottomAnchor
previousStep = step
}
bottomAnchor.constraint(equalTo: anchor).isActive = true
previousStep?.imageBottomConstraint?.constant = 0
(subviews.last as? Step)?.heightConstraint?.isActive = false
}
func resetSteps() {

View File

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