ios - 如何调整纵向和横向 View 的约束?

标签 ios autolayout

我有 3 个简单的按钮,如何调整纵向和横向 View 的约束,如下所示?

肖像:

enter image description here

风景:

enter image description here

最佳答案

我会将这些按钮放在堆栈 View 下并设置如下约束

enter image description here

高度和宽度的倍数均设置为 0.8,即尺寸的 80%。并且stackview的分配要Fill Equal。这将导致:

肖像

enter image description here

风景

enter image description here

将中心与 Superview 的 X 和 Y 对齐。它们将始终居中。

关于ios - 如何调整纵向和横向 View 的约束?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56844320/

相关文章:

ios - 键盘显示时更改自动布局常量

ios - 更改 UIImageView 的位置后是否需要更新约束

iphone - 无法在工作区的XCode 4中链接静态库

objective-c - CCLabelTTF SetString 未更新

ios - 来自动态 UITableView 的动态转场似乎是不可能的

ios - 如何调试自动布局约束?

ios - 调整 titleEdgeInsets 和 imageEdgeInsets 时,UIButton 上的标题和文本之间的间距不正确

ios - 核心数据 - NSManagedObject 返回 nil

ios - topLayoutGuide 在 vi​​ewWillAppear 之后应用

iOS 8 autolayout 约束在不同的大小类中搞砸了