Reputation: 1138
I want to switch between 2 constraints when device orientation changed. But even if I set the isActive
to false
, systems keeps showing me the Unable to simultaneously satisfy constraints.
warning and I lost one of those constraints for the whole app life cycle.
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
if UIDevice.current.orientation.isLandscape {
iPadPortraintWidthConstraint.isActive = false
iPadLandscapeWidthConstraint.isActive = true
} else {
iPadLandscapeWidthConstraint.isActive = false
iPadPortraintWidthConstraint.isActive = true
}
}
What should be done here?
Upvotes: 0
Views: 46