gpt4 book ai didi

ios - 约束问题

转载 作者:行者123 更新时间:2023-12-01 19:31:26 25 4
gpt4 key购买 nike

我在约束方面遇到了麻烦。任何想法,将不胜感激!!
我尝试使用调试器在UIViewAlertForUnsatisfiableConstraints上创建一个符号断点,但我不知道如何解决该问题。
这是代码:

func makeFullScreen(){
sceneView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
sceneView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: 0),
sceneView.rightAnchor.constraint(equalTo: self.view.rightAnchor, constant: 0),
sceneView.leftAnchor.constraint(equalTo: self.view.leftAnchor, constant: 0),
sceneView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: 0),
])
}
这是错误:
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:0x28234ff70 ARSCNView:0x11a450d60.bottom == UILayoutGuide:0x283932f40'UIViewSafeAreaLayoutGuide'.bottom (active)>",
"<NSLayoutConstraint:0x28234fd90 ARSCNView:0x11a450d60.top == UILayoutGuide:0x283932f40'UIViewSafeAreaLayoutGuide'.top (active)>",
"<NSLayoutConstraint:0x28234f7f0 ARSCNView:0x11a450d60.centerY == UIView:0x117daeeb0.centerY (active)>",
"<NSLayoutConstraint:0x28234fe80 'UIViewSafeAreaLayoutGuide-bottom' V:[UILayoutGuide:0x283932f40'UIViewSafeAreaLayoutGuide']-(34)-| (active, names: '|':UIView:0x117daeeb0 )>",
"<NSLayoutConstraint:0x28234fe30 'UIViewSafeAreaLayoutGuide-top' V:|-(44)-[UILayoutGuide:0x283932f40'UIViewSafeAreaLayoutGuide'] (active, names: '|':UIView:0x117daeeb0 )>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x28234f7f0 ARSCNView:0x11a450d60.centerY == UIView:0x117daeeb0.centerY (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2020-06-23 20:15:25.809104+0100 App[3611:633364] [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:0x28234ff70 ARSCNView:0x11a450d60.bottom == UILayoutGuide:0x283932f40'UIViewSafeAreaLayoutGuide'.bottom (active)>",
"<NSLayoutConstraint:0x28234fd90 ARSCNView:0x11a450d60.top == UILayoutGuide:0x283932f40'UIViewSafeAreaLayoutGuide'.top (active)>",
"<NSLayoutConstraint:0x28234f610 ARSCNView:0x11a450d60.height == UIView:0x117daeeb0.height (active)>",
"<NSLayoutConstraint:0x28234fe80 'UIViewSafeAreaLayoutGuide-bottom' V:[UILayoutGuide:0x283932f40'UIViewSafeAreaLayoutGuide']-(34)-| (active, names: '|':UIView:0x117daeeb0 )>",
"<NSLayoutConstraint:0x28234fe30 'UIViewSafeAreaLayoutGuide-top' V:|-(44)-[UILayoutGuide:0x283932f40'UIViewSafeAreaLayoutGuide'] (active, names: '|':UIView:0x117daeeb0 )>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x28234ff70 ARSCNView:0x11a450d60.bottom == UILayoutGuide:0x283932f40'UIViewSafeAreaLayoutGuide'.bottom (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

最佳答案

错误消息是明确的。您无法设置上下和居中Y高度。这是一个过分的决定。选择顶部和底部,或者选择中心和高度。
问问自己,centerY / height约束来自哪里,很有趣,因为它们不在您显示的代码中,因此我不知道答案。在其他地方必须有更多代码。也许这些是您之前设置的约束?如果是这样,您必须首先删除它们。

关于ios - 约束问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62542478/

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