【发布时间】:2018-07-22 03:41:07
【问题描述】:
您好,我是 UIStackViews 的新手。
所以我有一个包含 8 个标签的垂直 Stackview。
但是,我的 Stackview 的问题是,每当我将标签隐藏在其中时,我的 stackview 都不会调整大小。
The labels within the Red Rectangle are in my Stackview
When I hide those labels of the Stackview, I want my screen to look like this
However for some reason when I hide those labels, it looks like this instead with all the space visible and the stuff at the bottom doesn't go up
我该如何解决这个问题?
以下是我隐藏标签的方式:
override func viewDidLoad() {
super.viewDidLoad()
showingResultLabel.isHidden = true
addressLabel.isHidden = true
costOfKitLabel.isHidden = true
costOfModularLabel.isHidden = true
dispatchedFromLabel.isHidden = true
kitHomecostLabel.isHidden = true
modularHomecostLabel.isHidden = true
dispatchFromLabel.isHidden = true
谢谢
【问题讨论】:
-
看起来你必须隐藏红色区域并向上移动橙色区域。和堆栈视图中的红色区域,但橙色区域不在堆栈视图中。对吗??
-
@HiteshAgarwal 没错!
-
检查约束是否将固定高度设置为 stackview ??
-
嗨,我的 stackview 没有限制
-
可能是您将约束设置为底部标签,它不会让它上升。您是否将底部约束设置为等于“估计...”标签
标签: ios swift xcode uistackview