在转到设置按钮我设置了Trailing Space to Container Margin和Bottom Space to Bottom Layout Guide然后我 ctrl+Drag 从 Back button 到 Go To Settings button 并设置 Equal Widths代码>约束,我明白了.然后我更新与 Go To Settings button 相同的 Back button 宽度,即 101 并且所有约束都变成蓝色.但是无论屏幕大小如何,我都希望两个按钮都覆盖屏幕的一半,与第一个屏幕截图中所示相同,如何实现? 解决方案 你可以像这样使用与第二个按钮等宽的按钮来完成输出为这里是 苹果指南Using auto layout I am trying to create two buttons on the bottom like thisAfter dragging two buttons I set constraints like thisOn Back button I set Leading Space to Container Margin and Bottom Space to Bottom Layout GuideOn Go To Settings button I set Trailing Space to Container Margin and Bottom Space to Bottom Layout GuideThen I ctrl+Drag from Back button to Go To Settings button and set the Equal Widths constraint and I get this.Then I update the Back button width same as Go To Settings button which is 101 and all constraints turn to blue.But I want both buttons to cover half of the screen no matter what the size of screen is, same as shown in first screen shot, How to accomplish this? 解决方案 you can done it using equal width to 2nd button like thisand the output isHere is apple guide 这篇关于需要帮助设置两个等宽的按钮,并排自动布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-31 01:31