Jos*_*osh 5 ios autolayout swift
我在视图控制器中有以下视图层次结构:
视图->子视图->按钮
该按钮必须放置在右侧,与总屏幕宽度成一定比例的距离。子视图(按钮的超级视图)的前导和尾随约束为零。现在在故事板中,我对按钮的前缘有以下约束:
按钮.前导 = 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.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
681 次 |
| 最近记录: |