我在viewcontroller中有以下视图层次结构:
视图->子视图->按钮
按钮必须按屏幕总宽度的一定比例放置在右侧。子视图(按钮的超级视图)的前导和尾随约束为零。现在在情节串连板中,我对按钮的前缘有以下限制:
button.leading=343/375*尾随
运行应用程序时,按钮位于正确位置,但出现以下自动布局错误:
[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.