【问题标题】:How to dynamically change superview's height with autolayout如何使用自动布局动态更改超级视图的高度
【发布时间】:2016-01-17 15:21:17
【问题描述】:

我在一个视图中有两个子视图,它们的大小通过自动布局中的约束进行管理。

相对于子视图的高度,如何更改父视图的高度?

我刚刚创建了一个有问题的存储库:https://github.com/Deviasoft-Official/IOS-ScrollViewAndAutoLayout

更准确地说,我的问题是如何删除此文件中的第 36 行: https://github.com/Deviasoft-Official/IOS-ScrollViewAndAutoLayout/blob/master/ScrollViewAndAutolayout/ViewController.swift

【问题讨论】:

    标签: ios swift autolayout nslayoutconstraint


    【解决方案1】:

    这里讨论了这个问题。

    Resize the superview automatically with auto layout.

    UIScrollView auto height in Swift

    我设法通过在 xib 中应用自动布局来实现这一点。如果您不使用 xib,请在 Visual Format 中尝试相同的逻辑。 否则,如果有xib,最好在那里给出约束。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-02
      • 1970-01-01
      • 2013-10-10
      • 2018-02-22
      • 1970-01-01
      • 1970-01-01
      • 2017-11-18
      • 1970-01-01
      相关资源
      最近更新 更多