gpt4 book ai didi

ios - 如何解决我的 View 的自动布局约束

转载 作者:行者123 更新时间:2023-11-29 05:20:55 26 4
gpt4 key购买 nike

warnings for autolayout Storyboard screenshot我需要你的帮助。如何解决自动布局的警告。

以下是我的组件层次结构:

View Controller
查看
- 查看
--表格 View
---表格单元格
1. 标题标签
2.编辑按钮
3.删除按钮

我提供了如下约束:

标题标签:

Leading space to superview
trailing space to Edit button
bottom space to superview
top space to superview

编辑按钮

trailing space to remove button
leading space to title label
bottom space to superview
top space to superview

删除按钮

Trailing space to superview
width = 40
leading space to edit button
align center Y
height = 40

我收到警告“标题标签、编辑和删除按钮需要 X 和宽度”。

有什么帮助吗?

最佳答案

编辑按钮宽度约束设置为40,与“删除”按钮宽度相同。

编辑按钮

trailing space to remove button
leading space to title label
width = 40
bottom space to superview
top space to superview

如果按钮宽度不固定则需要更新内容拥抱优先级 水平值。

Select the Edit button and change the Content Hugging Priority Horizontal value 250 to 251

Select the Title Label and change the Content Hugging Priority Horizontal value 250 to 249

enter image description here

希望这会有所帮助。

关于ios - 如何解决我的 View 的自动布局约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58687896/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com