How to add Equal Spacing and equal width for button in iOS Auto layout

前端 未结 5 1982
终归单人心
终归单人心 2020-11-29 00:54

Am new to Auto layout constraints in Xcode. I have one Bottom View like UITabBar with 6 UIButtons. Without constraints I aligned those buttons with

5条回答
  •  感情败类
    2020-11-29 01:12

    Spacer views should no longer be necessary unless you need space between borders.

    You can create a StackView with equal spacing which will dynamically adjust the space between your stack views to use up all available space without altering the size of your subviews.

    Interface builder can be a bit misleading here. the value you put in for spacing is the minimum spacing required not what the actual spacing will be.

    The StackView will handle your spacing, making the size of your buttons equal you can use regular constraints for.

提交回复
热议问题