Reputation: 2361
I'm new to autolayout. Can somebody please explain why this is not working?
MAFeedbackCell is the container for the two labels. There are other labels in the containers, but these two: 0xaa3aca0
and 0x14395240
are the ones that have the conflict.
2014-09-28 08:38:26.056 beats[1052:60b] 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:0xaa3aea0 UILabel:0xaa3aca0.width <= 0.125*MAFeedbackCell:0x14394d90.width>",
"<NSLayoutConstraint:0xa657130 H:|-(1)-[UILabel:0xaa3aca0](LTR) (Names: '|':MAFeedbackCell:0x14394d90 )>",
"<NSLayoutConstraint:0x143955c0 H:[UILabel:0xaa3aca0]-(1)-[UILabel:0x14395240](LTR)>",
"<NSLayoutConstraint:0x143959c0 UILabel:0x14395240.width == UILabel:0xaa3aca0.width>",
"<NSLayoutConstraint:0xa558fc0 UILabel:0x14395240.right == MAFeedbackCell:0x14394d90.right - 1>",
"<NSLayoutConstraint:0xa541660 'UIView-Encapsulated-Layout-Width' H:[MAFeedbackCell:0x14394d90(231)]>"
)
Upvotes: 0
Views: 124
Reputation: 385500
You have the MAFeedbackCell
superview and two UILabel
subviews.
The left label (0xaa3aca0
) is constrained to be no more than one eighth as wide as the superview:
UILabel:0xaa3aca0.width <= 0.125*MAFeedbackCell:0x14394d90.width
(Note that 0.125 = 1 / 8.)
The left label (0xaa3aca0
) and the right label (0x14395240
) are constrained to have the same width as each other:
UILabel:0x14395240.width == UILabel:0xaa3aca0.width
So the right view must also be no more than one eighth as wide as the superview.
The left label's left edge is constrained to be one point inside of the superview's left edge:
H:|-(1)-[UILabel:0xaa3aca0](LTR) (Names: '|':MAFeedbackCell:0x14394d90 )
The right label's right edge is constrained to be one point inside of the superview's right edge:
UILabel:0x14395240.right == MAFeedbackCell:0x14394d90.right - 1
The two labels are constrained to be separated by one point:
H:[UILabel:0xaa3aca0]-(1)-[UILabel:0x14395240](LTR)
So let's say L is the width of each label, and M is the width of the superview.
These constraints require that 1 + L + 1 + L + 1 == M, and also that L <= M / 8.
Simplify the first equation to 3 + 2 * L == M and substitute into the second: L <= (3 + 2 * L) / 8. Simplify that to L <= 1/2. So we can satisfy all those constraints… if each label is no more than one half a point wide. That would require that the superview be no more than four points wide.
Unfortunately for you, the superview is constrained to be 231 points wide:
H:[MAFeedbackCell:0x14394d90(231)]
Thus your constraints are unsatisfiable.
Upvotes: 5