竖屏居中
横屏居中
操作步骤:
(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.youkuaiyun.com/newadice/autolayout_twobuttons.git