Create horizontal UIStackView programmatically

Swift3:

let stackView = UIStackView()
stackView.axis = .horizontal
stackView.alignment = .fill // .leading .firstBaseline .center .trailing .lastBaseline stackView.distribution = .fill // .fillEqually .fillProportionally .equalSpacing .equalCenteringlet label = UILabel()
label.text = “Text”
stackView.addArrangedSubview(label)
// for horizontal stack view, you might want to add width constraint to label or whatever view you’re adding.

Swift

let stackView = UIStackView()
stackView.axis =…

--

--

iOS Developer, Triple graduated, Passionate, Love workout, blogger

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mr.Javed Multani

iOS Developer, Triple graduated, Passionate, Love workout, blogger