4
votes

I have the following view hierarchy in a viewcontroller:

view->subView->button

The button has to be placed on the right at a certain proportional distance of the total screen width. Subview (the superview of button) has leading and trailing constraints to be zero. Now in storyboard, I have the following constraint for leading edge of the button:

button.leading = 343/375*trailing

When I run the app, button is at the correct position but I get the following AutoLayout error:

[LayoutConstraints] Could not resolve symbolic constant for constraint, because: Attributes must match for NSSpace between view and superview.
mismatched attributes: leading of <UIButton: 0x7f86efd51410; frame = (378.667 -1.33333; 8 21); opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x600000433780>>, and trailing of <UIView: 0x7f86efe42410; frame = (0 60; 414 277); autoresize = RM+BM; gestureRecognizers = <NSArray: 0x600000447830>; layer = <CALayer: 0x60c000238660>>
Use a symbolic breakpoint at NSLayoutConstraintFailedToFindDefaultResolvedValueForSymbolicConstant to debug.
1

1 Answers

3
votes

Open interface builder, find constraints lead error and try to change value in Constant field from Standard to 0