【问题标题】:iOS - Can AutoLayout make constraint like view0.height = view1.height + view2.height?iOS - AutoLayout 可以像 view0.height = view1.height + view2.height 这样的约束吗?
【发布时间】:2017-04-29 12:51:44
【问题描述】:

我想做一个像view0.height = view1.height + view2.height 这样的约束。当view1.heightview2.height 改变时,view0.height 会自动改变。

在 iOS AutoLayout 中可以通过吗?

【问题讨论】:

    标签: ios autolayout


    【解决方案1】:

    是的,如果 view0 同时包含 view1 和 view2 是可能的,那么您只需要提供适当的约束即可。像这样:

    【讨论】:

    • 所以要做到这一点,容器视图的子视图必须有高度约束,顶部和底部对容器视图有适当的约束,对吧?
    • @tom 是的,完全正确
    猜你喜欢
    • 1970-01-01
    • 2015-10-09
    • 2019-03-27
    • 2016-04-05
    • 1970-01-01
    • 2013-03-19
    • 1970-01-01
    • 2021-07-14
    • 2012-10-28
    相关资源
    最近更新 更多