refactored code for stack
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
143ebccb34
commit
0dce42fb37
@ -42,15 +42,15 @@ import UIKit
|
||||
|
||||
public lazy var stack: UIStackView = {
|
||||
errorLabel.isHidden = true
|
||||
let s = UIStackView(arrangedSubviews: [titleLabel, entryFieldContainer, errorLabel, feedbackLabel])
|
||||
s.axis = .vertical
|
||||
s.alignment = .fill
|
||||
s.distribution = .fill
|
||||
s.setCustomSpacing(Padding.One, after: titleLabel)
|
||||
s.setCustomSpacing(Padding.Two, after: entryFieldContainer)
|
||||
s.setCustomSpacing(Padding.One, after: errorLabel)
|
||||
s.translatesAutoresizingMaskIntoConstraints = false
|
||||
return s
|
||||
let stack = UIStackView(arrangedSubviews: [titleLabel, entryFieldContainer, errorLabel, feedbackLabel])
|
||||
stack.axis = .vertical
|
||||
stack.alignment = .fill
|
||||
stack.distribution = .fill
|
||||
stack.setCustomSpacing(Padding.One, after: titleLabel)
|
||||
stack.setCustomSpacing(Padding.Two, after: entryFieldContainer)
|
||||
stack.setCustomSpacing(Padding.One, after: errorLabel)
|
||||
stack.translatesAutoresizingMaskIntoConstraints = false
|
||||
return stack
|
||||
}()
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -205,8 +205,8 @@ import UIKit
|
||||
|
||||
stack.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor).isActive = true
|
||||
stack.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true
|
||||
stack.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor).isActive = true
|
||||
stack.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor).isActive = true
|
||||
layoutMarginsGuide.trailingAnchor.constraint(equalTo: stack.trailingAnchor).isActive = true
|
||||
layoutMarginsGuide.bottomAnchor.constraint(equalTo: stack.bottomAnchor).isActive = true
|
||||
}
|
||||
|
||||
@objc open override func layoutSubviews() {
|
||||
@ -222,11 +222,6 @@ import UIKit
|
||||
|
||||
@objc open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
|
||||
titleLabel.updateView(size)
|
||||
errorLabel.updateView(size)
|
||||
feedbackLabel.updateView(size)
|
||||
entryFieldContainer.updateView(size)
|
||||
stack.updateView(size)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user