IOS Constraints for height(动态高度变化)

Posted

技术标签:

【中文标题】IOS Constraints for height(动态高度变化)【英文标题】:IOS Constraints for height (dynamic height change) 【发布时间】:2014-10-16 23:28:31 【问题描述】:

我无法让我的 XIB 文件包含视图的约束值,这将增加视图而不覆盖其下方的视图。我不确定我做错了什么。

基本上

(view1 here) -- lets say
(view2 here) -- lets say

两者都在更大的视图中,但是当视图 1 像这样增加时

(view1 here)
(view1 increased content here) -- view2 would now be covered instead of

(view1 here)
(view1 increased content here)
(view2 here) -- like it should be.

很抱歉没有使用图片,但问题似乎很简单。我尝试添加约束,但没有奏效,是否有一些更容易以编程方式完成的事情,或者?我在这方面花了很多时间,我知道我可以做几件事,但我不明白为什么当我有垂直间距和顶部视图等时我的约束不起作用。似乎没有任何作用。

编辑更新: 正如您从图片中看到的那样,我需要所有这些都相应地调整大小。当我更改其中一个的 tableview 高度时,以及与它们所在位置的标签对应关系。图像视图将始终存在,它们都包含在滚动视图中的视图中,如图所示。

【问题讨论】:

【参考方案1】:

您必须在 View2 的顶部和视图 1 的底部之间添加一个等于 0 的约束。

【讨论】:

以上是关于IOS Constraints for height(动态高度变化)的主要内容,如果未能解决你的问题,请参考以下文章

No validator could be found for constraint ‘javax.validation.constraints.Pattern‘ validating type ‘j

Neutron数据库同步错误 NotImplementedError: No support for ALTER of constraints in SQLite dialect

泡泡一分钟:Geometric and Physical Constraints for Drone-Based Head Plane Crowd Density Estimation

如何使用 AutoLayout Constraints 在 ios xcode 6.3 中的多个标签之间创建相等的间距

带有约束的滚动视图中的iOS Swift stackview

iOS 渐变进度条