ios - LayerView AutoLayout 上的约束按钮

标签 ios uibutton autolayout

我试图成功对齐位于layerViewTOP 上的2 个UIButton

层次结构如下:

enter image description here

按钮位于 layerView 的顶部(只是一个黑色的 UIView,具有特定的 alpha)。 现在我希望按钮在这个“容器”中对齐。

像这样:

enter image description here

我正在将 constraints 设置到左侧,将 top + 设置到右侧和顶部。还保持纵横比。

这是结果:

enter image description here

所以只是按钮出了问题。 有人知道解决这个问题的另一种方法吗?

最佳答案

  1. 将按钮嵌入 UIView
  2. UIView 设置为固定宽度和高度
  3. UIView 设置为水平居中对齐。
  4. 由于“层 View ”具有动态高度,因此将 UIView 的底部空间设置为“层 View ”

关于ios - LayerView AutoLayout 上的约束按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37730856/

相关文章:

ios - 使用自动布局制作完美的正方形

ios - 为什么创建非 Controller 文件时默认没有@interface?

ios - UIImageView+AFNetworking maxConcurrentOperationCount

uitableview - 按下按钮时在 UITableViewCell 中找到按钮的 indexPath?

iphone - 在iOS中使用UIButtonTypeCustom选项进行初始化

iOS:将两个 UIButton 合并为一个 UIButton

ios - 自动布局约束冲突

swift - NSSplitView 部分崩溃

ios - Xamarin - 构建绑定(bind)库 Messaging.g.cs 时出错

ios - 有没有办法从 Safari 检查通用链接注册?