1

I do have a UIScrollView which holds a couple of UIViewController. For the elements inside the UIViewController I used AutoLayout. Now I'd like to change the constants of the view constraints if the current device is a iPhone 4. So I override updateViewConstraints() of the UIViewControllers:

override func updateViewConstraints() {

    if (self.view.frame.height == 480) {

        self.imageMarginLeft.constant = 40
        self.imageMarginRight.constant = 40
        self.textMarginTop.constant = 10

        println("updateViewConstraint \(self.imageMarginRight.constant)")
    }

    super.updateViewConstraints()
} 

But even the println logs the correct new constant the update is not visible. What do I have to change in my implementation?

Ioquai
  • 377
  • 6
  • 16

1 Answers1

5

As explained here I had to integrate self.view.layoutIfNeeded() before and after changing the view contstraint constant.

Community
  • 1
  • 1
Ioquai
  • 377
  • 6
  • 16