gpt4 book ai didi

ios - View 和 super View 之间的 NSSpace 属性必须匹配(自动布局)

转载 作者:行者123 更新时间:2023-12-02 00:05:22 25 4
gpt4 key购买 nike

我在 View Controller 中有以下 View 层次结构:

view->subView->button

按钮必须放置在右侧,与总屏幕宽度成一定比例的距离。 subview (按钮的 super View )的前导和尾随约束为零。现在在 Storyboard中,我对按钮的前缘有以下约束:

button.leading = 343/375*trailing

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

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

最佳答案

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

关于ios - View 和 super View 之间的 NSSpace 属性必须匹配(自动布局),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50443326/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com