当它没有字符串时,如何将 stackview 中的 UILabel 设置为零
How do I set UILabel in stackview to zero when It has no strings
您好,我正在尝试使用 AutoLayout
、StackView
我在 StackView 中有 3 个 UILabels
。
我想实现当 UILabel
没有字符串时将 UILable
高度设置为零。但它不起作用。
我了解内容拥抱所以我也尝试设置优先级但似乎不起作用
有人知道吗?
更新
我解决了这个问题。真的很简单。
if cell.descriptionLabel.text!.isEmpty == true {
cell.descriptionLabel.isHidden = true
}
就是这样了!!
希望大家解决类似的问题
将您的身高 NSLayoutconstrain
设置为 IBOutlet
并在没有任何 .text 使用 Delegate 来实现时将其设置为 0
。
if yourLabel.text == ""{
//here
}
您好,我正在尝试使用 AutoLayout
、StackView
我在 StackView 中有 3 个 UILabels
。
我想实现当 UILabel
没有字符串时将 UILable
高度设置为零。但它不起作用。
我了解内容拥抱所以我也尝试设置优先级但似乎不起作用
有人知道吗?
更新
我解决了这个问题。真的很简单。
if cell.descriptionLabel.text!.isEmpty == true {
cell.descriptionLabel.isHidden = true
}
就是这样了!!
希望大家解决类似的问题
将您的身高 NSLayoutconstrain
设置为 IBOutlet
并在没有任何 .text 使用 Delegate 来实现时将其设置为 0
。
if yourLabel.text == ""{
//here
}