Pick the fix
The console says 'Unable to simultaneously satisfy constraints' and lists NSAutoresizingMaskLayoutConstraint. Fix?
Hint 1 of 1
Where does NSAutoresizingMaskLayoutConstraint come from?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Set translatesAutoresizingMaskIntoConstraints = false on the view before activating its constraints
Correct. Otherwise UIKit adds constraints from the frame that fight yours.
Why not the others?
- B Lower your constraints' priority to 999. That hides the conflict, and the frame-based constraints win.
- C Call
layoutIfNeeded()after activating. It only runs layout sooner; the conflict remains. - D Set the frame manually as well. Mixing frames and constraints is the cause, not the fix.