【问题标题】:Attributes must match for NSSpace between view and superview (AutoLayout)视图和超级视图之间的 NSSpace 属性必须匹配(AutoLayout)
【发布时间】:2018-05-21 06:41:50
【问题描述】:

我在视图控制器中有以下视图层次结构:

视图->子视图->按钮

按钮必须放置在屏幕总宽度的某个比例距离的右侧。子视图(按钮的父视图)的前导和尾随约束为零。现在在情节提要中,我对按钮的前缘有以下约束:

button.leading = 343/375*trailing

当我运行应用程序时,按钮位于正确的位置,但出现以下 AutoLayout 错误:

[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.

【问题讨论】:

    标签: ios swift autolayout


    【解决方案1】:

    打开界面生成器,找到约束导致错误并尝试将常量字段中的值从Standard更改为0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多