I am trying to build a vertical stack view with a UI label and multiple horizontal stack views, However, I only see the multiple horizontal stacks in the UI and not the UI label. Here is some code
final class FinalView: UIView {
let mainStackView = UIStackView()
init() {
super.init(frame: .zero)
let label: UILabel = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.text = "Sorry ?"
...
let verticalStackView = UIStackView(arrangedSubviews: multiplehorizontalViews)
verticalStackView.axis = .vertical
verticalStackView.translatesAutoresizingMaskIntoConstraints = false
verticalStackView.spacing = 5.0
mainStackView.addArrangedSubview(label)
mainStackView.addArrangedSubview(verticalStackView)
mainStackView.translatesAutoresizingMaskIntoConstraints = false
mainStackView.axis = .vertical
}
}
I am only seeing verticalStackView
but not label
. When I removed this mainStackView.addArrangedSubview(verticalStackView)
from the code, I can see the label. But When it is there I can't see the label. Any ideas on the issue or any tips for debugging?