Autolayout: update restrictions for UICollectionViewCell not working

I have a problem trying to update my UILabel restrictions for my collectible ViewCell. My prototype cell looks like this:

Cell prototype

My goal: I need to edit the red constraint constant of the top label, depending on whether I hide or not the green label.

How did I go on?

  • I added an IBoutlet to restrict the red label (the one with the red arrow):

    @IBOutlet weak var descriptionTopToPrice: NSLayoutConstraint!

  • Then:

    descriptionTopToPrice.constant = 2

    self.contentView.setNeedsUpdateConstraints()

But this does not work, and the restrictions are not updated.

Did I miss something?

+4
source share
1 answer

. 2 , . , . , . , .

0

All Articles