Swift UIView封装的布局宽度和布局约束
我在运行应用程序时遇到以下错误。我有什么样的视觉问题Swift UIView封装的布局宽度和布局约束,swift,Swift,我在运行应用程序时遇到以下错误。我有什么样的视觉问题 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 hel
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.
2019-06-15 17:45:15.916490+0300 ...[3888:779219] [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.
(
"<SnapKit.LayoutConstraint:0x280cf51a0@MainTableViewController.swift#3209 ....DeviceTableViewCell:0x10c82cc00.width == 375.0>",
"<NSLayoutConstraint:0x280be41e0 'UIView-Encapsulated-Layout-Width' ....DeviceTableViewCell:0x10c82cc00'cellId'.width == 0 (active)>"
)
Will attempt to recover by breaking constraint
<SnapKit.LayoutConstraint:0x280cf51a0@MainTableViewController.swift#3209 ...DeviceTableViewCell:0x10c82cc00.width == 375.0>
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.
cell.snp.makeConstraints { (make) in
make.top.equalTo(100)
make.height.equalTo(205)
make.width.equalTo(view.frame.width)
}
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。
2019-06-15 17:45:15.916490+0300…[3888:779219][布局约束]无法同时满足约束。
可能下面列表中至少有一个约束是您不想要的。
试试这个:
(1) 看看每一个约束,试着找出你不期望的;
(2) 找到添加了不需要的约束的代码,然后修复它。
(
"",
""
)
将尝试通过打破约束进行恢复
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。
cell.snp.makeConstraints{(make)in
make.top.equalTo(100)
制造高度等于(205)
make.width.equalTo(view.frame.width)
}
我认为您对特定的单元格有两个宽度限制,请检查
- 转到你的故事板
- 打开右侧菜单
- 在顶部单击“尺寸检查器”并检查约束
或者尝试更改宽度约束的优先级
make.width.equalTo(view.frame.width).priority(999)
如何将其设计为在所有设备上工作?我得把宽度改成什么。也谢谢你的回复我没有使用故事板,我是用视觉代码做的。我在主题中添加了代码。我该怎么做?make.width.equalTo(view.frame.width.priority)(999)
@BerkooBek很高兴能帮上忙。如果我的问题是正确的,请标记并投票:)