Why UIStackView
resize subviews? I think its work when I set distribution
like .fill
. But .equalSpacing
does not imply such behavior. I'm right?
let stackView = UIStackView()
stackView.alignment = .firstBaseline
stackView.axis = .vertical
stackView.distribution = .equalSpacing
stackView.spacing = 0.0
stackView.translatesAutoresizingMaskIntoConstraints = true
self.view.addSubview(stackView)
stackView.snp.makeConstraints { (make) -> Void in
make.top.equalTo(button.snp.bottom)
make.left.equalTo(view).offset(16.0)
make.bottom.equalTo(view)
make.right.equalTo(view).offset(-16.0)
}
let exampleView = UIView(frame: .zero)
stackView.addArrangedSubview(exampleView)
exampleView.backgroundColor = .yellow
exampleView.snp.makeConstraints { (make) in
make.width.equalToSuperview()
make.height.equalTo(60.0)
}
A
UIStackView
will arrange its subviews.That means: