iOS 自动布局 : Place a button exactly in the middle of two other buttons horizontally

标签 ios cocoa-touch ios-autolayout

我正在尝试构建一个如下所示的 View :enter image description here

我面临的挑战是我无法确定将 Button2 精确放置在 Button1< 的中心中所需的约束/strong> 和 Button3

所有其他约束都已满足,只是在解决这个问题。任何帮助将不胜感激

最佳答案

将该按钮嵌入到 UIView 中。并在容器约束中对其设置水平居中,并为其提供顶部、固定高度和宽度或前导和尾随约束。并设置其他两个按钮的顶部、前导、尾部和固定高度。

或者您可以为每个按钮赋予相同的宽度,并相应地管理约束。

主要关注的是在一个单独的 UIView 中使用该标签。然后相应地管理约束。

关于iOS 自动布局 : Place a button exactly in the middle of two other buttons horizontally,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37559775/

相关文章:

ios - 在iOS中使用核心数据映射业务对象

ios - 如何通过约束调整此 View

iphone - UISearchDisplayController,对 UITableView 的引用是什么?

iphone - 模型- View - Controller 模式如何应用于 iPhone 开发?

ios - 崩溃: constraint is nil in viewController2 while rotating on viewController1

ios - Sencha Touch中的iOS Mobile Safari上未触发模糊事件

ios - 如何在 iOS 中使用 AVFoundation 压缩视频

ios - 在 iOS 中为多个设备和不同方向启动屏幕 Storyboard

ios - UITableViewCell 自动调整大小问题

ios - calayer 没有根据 tableview 单元格中的 UIView 大小而改变