activateConstraints: and deactivateConstraints: not persisting after rotation for constraints created in IB

前端 未结 3 479
遥遥无期
遥遥无期 2020-12-05 13:41

The new NSLayoutConstraint methods activateConstraints: and deactivateConstraints: don\'t appear to work correctly with IB-created con

3条回答
  •  攒了一身酷
    2020-12-05 14:01

    I faced a similar situation.

    I created two sets of NSLayoutConstraints in interface builder. Each set for one case. One set was "installed" the other not.

    When I switch the case the coresponding set of layout constraint was activated and the other was deacticated. An as described in the Qusteion rotating forth and back does not work properly.

    Is solved this by installing both sets in interface builder. And to get rid of the warnings I used a slighlt lower priority (999) for the second set. This worked for me.

    Btw: Strang i used the "installed/not installed" aproach on another viewcontroller, their it worked.

    In the not working case the viewcontroller was embedded in a containerview, perhaps that was the reason.

提交回复
热议问题