简体   繁体   中英

Unable to simultaneously satisfy constraints. Leading and Trailing constraints conflicts

Can somebody help me understand these errors and and suggest how to go about solving them?

2014-09-19 08:52:45.812 Zazzle[23292:1834589] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)

 ( "<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 )> 

fromFollow the below steps

  1. Check the constraints of a UiObject and remove any constraints that duplicated, from size inspector of Xcode.
  2. If there is no duplication,find out exact constraint that cause the problem
  3. Try to change the priority of constraint from default required(1000) to high(750).

The conflict is right there: the first two constraints set the subview's leading and trailing values to be 8 pixels away from the containing view controller's left and right edges, while the third and fourth lines set them to be exactly even with the containing view's edges. Remove one pair or the other, or, as @dasdom said, lower the priorities of one of the constraint pairs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM