竖屏居中
横屏居中
操作步骤:
(1)设置2个button的上,左,右的距离。
(2)并将第一个button的左边距离设置为优先级为250, 第二个button的右边距离设置为优先级250.
(3)选中2个button,设置horizontal center in container。
(4)设置完成后,点击系统的红色箭头,点击任意一个黄色提示。
(5)在弹出框中,选择update constraints 并选择下面的Apply to all views in container
这样就设置好了2个button在屏幕居中。
Demo地址 https://code.csdn.net/newadice/autolayout_twobuttons.git
本文将指导您如何使用特定操作步骤在横竖屏设备上实现两个按钮的居中布局,通过调整按钮的位置距离并应用容器约束,轻松完成布局设置。

1280

被折叠的 条评论
为什么被折叠?



