gpt4 book ai didi

ios - Swift Xcode 会尝试通过打破约束来恢复吗?

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:08:25 25 4
gpt4 key购买 nike

当我使用由 Swift 4 开发的应用程序时,我在 xCode Log 上收到消息,我的 tableview 有多个不同的单元格,大约 12 个不同的单元格,我收到的警告消息是:

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-08-21 09:27:57.404497+0300 muzeit[6449:2211903] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x174481770 V:|-(0)-[UIImageView:0x107a09eb0] (active, names: '|':UIView:0x107a09d10 )>",
"<NSLayoutConstraint:0x174481860 V:[UIImageView:0x107a09eb0]-(-60)-| (active, names: '|':UIView:0x107a09d10 )>",
"<NSLayoutConstraint:0x1744818b0 UIImageView:0x107a09eb0.centerY == UIView:0x107a09d10.centerY (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1744818b0 UIImageView:0x107a09eb0.centerY == UIView:0x107a09d10.centerY (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-08-21 09:27:57.492890+0300 muzeit[6449:2211903] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x17048b770 V:|-(0)-[UIImageView:0x107a30c30] (active, names: '|':UIView:0x107a30a90 )>",
"<NSLayoutConstraint:0x17048b860 V:[UIImageView:0x107a30c30]-(-60)-| (active, names: '|':UIView:0x107a30a90 )>",
"<NSLayoutConstraint:0x17048b8b0 UIImageView:0x107a30c30.centerY == UIView:0x107a30a90.centerY (active)>"
)

我试图用谷歌搜索它以找到一些解决方案如何解决它,我找不到明确的答案,而且断点没有显示约束有问题!

有什么想法吗?

最佳答案

如果您想更好地了解日志试图告诉您的内容,您可以查看 Visual Format Language .您可以按如下方式“翻译”您的日志:

V:|-(0)-[UIImageView:0x107a09eb0] = 在 super View 顶部 (|) 和 ImageView 之间设置一个 0 点的垂直 (V:) 空间

V:[UIImageView:0x107a09eb0]-(-60)-| = 在 UIImageView 的底部和 super View 之间设置 -60 点的垂直 (V:) 空间 (|)

UIImageView:0x107a09eb0.centerY == UIView:0x107a09d10.centerY (active) = 将 UIImageView 垂直居中到父 View

通过翻译,现在更容易理解您的 UIImageView 被固定在顶部和底部,这与第三个约束冲突,即试图垂直居中 UIImageView。

正如@ReinerMeilan 在评论中所建议的那样,您可以删除 centerY 约束以解决此自动布局问题。

关于ios - Swift Xcode 会尝试通过打破约束来恢复吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45790601/

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