What is the best approach for horizontally aligning 5 buttons with Autolayout

后端 未结 3 1700
余生分开走
余生分开走 2021-01-15 01:13

I know this is a little newbie style question but I couldn\'t find any subject about this and I have to horizontally align multiple buttons in my view controller.

I

3条回答
  •  庸人自扰
    2021-01-15 01:55

    You should use a horizontal stack view. You set the constraints of the stack view to its superview, and then drop in your buttons. You need to adjust spacing, stretch to fill, etc in the attributes inspector and it'll be perfectly aligned.

提交回复
热议问题