gpt4 book ai didi

iOS 10 : NSInvalidLayoutConstraintException: Constraint improperly relates anchors of incompatible types

转载 作者:搜寻专家 更新时间:2023-10-30 22:25:06 25 4
gpt4 key购买 nike

更新到 iOS 10 后,我在我的一个应用程序上遇到了一堆错误

NSInvalidLayoutConstraintException: Constraint improperly relates anchors of incompatible types:

<NSLayoutConstraint:0x170495270 UIView:0x1010e1d90.top == AppName.OtherView:0x1010dc6f0.centerX (active)>

我以前在使用这样的约束时从未遇到过问题,而且我只在我的 iOS 10 设备上遇到过它。有什么想法吗?

最佳答案

你可能正在做这样的事情:

NSLayoutConstraint(item: viewA, attribute:
.leading , relatedBy: .equal, toItem: parentView, attribute: .top, multiplier: 1.0, constant: 20)

因此您不会像 .leading.top 那样将正确的 anchor 拼接在一起。在这种情况下,它必须是 .leading.leading

有趣的是,这不是 iOS9 的问题。

关于iOS 10 : NSInvalidLayoutConstraintException: Constraint improperly relates anchors of incompatible types,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39532700/

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