pprevalon pprevalon - 1 year ago 123
Swift Question

Swift how to increase margins of arranged views

How can Increase the the margin of different

inside a
. I need to increase the the top margin the margins will be the same.

let formWrapperStackView:UIStackView = {
let v = UIStackView()
v.axis = .vertical
// v.distribution = .fillProportionally
v.spacing = 0
v.translatesAutoresizingMaskIntoConstraints = false

return v

enter image description here

Answer Source

It is not possible to have different spacing for different elements in a UIStackView. So a solution would be to wrap each of your textfields with a UIView and then set the top constraint of each textfield (between textfield and UIView) to your desired margin.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download