Limitations cannot be satisfied at the same time. Leading and trailing constraint conflicts

Can someone help me understand these errors and suggest how to resolve them?

2014-09-19 08: 52: 45.812 Zazzle [23292: 1834589] Cannot satisfy constraints at the same time. Probably at least one of the restrictions in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out what you are not expecting; (2) find the code that added unwanted restrictions or restrictions and fix it. (Note: If you see NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translated to AutoresizingMaskIntoConstraints)

(
    "<NSLayoutConstraint:0x7c0ba1e0 H:|-(8)-[UIView:0x7c0bb900]   (Names: '|':UIView:0x7c0b6c20 )>",
    "<NSLayoutConstraint:0x7c0ba210 H:[UIView:0x7c0bb900]-(8)-|   (Names: '|':UIView:0x7c0b6c20 )>",
    "<NSLayoutConstraint:0x7c0942e0 UIView:0x7c0b6c20.left == UIView:0x7c0bbfa0.left>",
    "<NSLayoutConstraint:0x7c0c03e0 UIView:0x7c0b6c20.right == UIView:0x7c0bbfa0.right>",
    "<NSLayoutConstraint:0x7c635250 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7c0bbfa0(2)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7c0ba210 H:[UIView:0x7c0bb900]-(8)-|   (Names: '|':UIView:0x7c0b6c20 )>

      

+3


source to share


2 answers


fromPerform the following steps



  • Check the UiObject constraints and remove any duplicates that are duplicated from the Xcode size inspector.
  • If there is no duplication, find the exact constraint causing the problem.
  • Try changing the priority of the constraint from the default (1000) to high (750).
+3


source


The conflict is right there: the first two constraints set the start and end values ​​of the subexpression 8 pixels from the holding left and right edges of the controller, while the third and fourth lines set them exactly with the contained view edges. Remove one pair or the other, or as @dasdom said, omit the priorities of one of the constraint pairs.



0


source







All Articles