【问题标题】:Make one view center as buttom of second view in Auto Layout - iOS [closed]在自动布局中将一个视图中心作为第二个视图的底部 - iOS [关闭]
【发布时间】:2018-02-15 15:55:55
【问题描述】:

有两个视图-我想显示背景图像的绿色视图,中心对齐到图像的底部,如下图所示

绿色视图高度也将是动态的。

【问题讨论】:

    标签: ios swift autolayout


    【解决方案1】:

    只需将 greenView 的 centerY 锚点约束到图像视图的底部锚点:

    greenView.centerYAnchor.constraint(equalTo: imageView.bottomAnchor).isActive = true
    greenView.centerXAnchor.constraint(equalTo: imageView.centerXAnchor).isActive = true
    

    【讨论】:

    • 真的很感谢你:)
    猜你喜欢
    • 1970-01-01
    • 2015-09-21
    • 1970-01-01
    • 1970-01-01
    • 2016-01-07
    • 1970-01-01
    • 1970-01-01
    • 2014-10-15
    • 2014-04-29
    相关资源
    最近更新 更多