-1

Hi I'm trying to use AutoLayout, StackView

I have 3 UILabels in StackView.

I want to implement that when UILabel has no Strings then set UILable height to zero. But It is not working.

I understood about contents hugging So I also try to set priority but It seems not working

Anyone knows about that?

enter image description here

enter image description here

Update

I solve this problem. It was really simple.

if cell.descriptionLabel.text!.isEmpty == true {
                cell.descriptionLabel.isHidden = true
            }

That's it!!

I hope you guys solve similar problem.

Shawn Baek
  • 1,928
  • 3
  • 20
  • 34
  • What are you trying to do? Are you trying to hide the label when it is empty? – bubibu Dec 21 '16 at 15:16
  • Hi thanks for reply. Before I had not uses stack view. added 3 UILables and make IBOulet of UILable's top constraints and checked isString or not programmatically. If has no string then I had changed UILable's top constraints. But I want implement via storyboard. – Shawn Baek Dec 21 '16 at 15:49

1 Answers1

1

Put your height NSLayoutconstrain as IBOutlet and set it as 0 when there aren't any .text using Delegate to achieve that.

if yourLabel.text == ""{
   //here

}
Federico Malagoni
  • 722
  • 1
  • 7
  • 21