Swift约束警告
Swift constraint warning
我尝试了所有方法,但找不到针对此警告的解决方案 XCode 向我抛出:
我有一个带有单元格的 tableView。
单元格是动态高度的,因为它们内部有视图:"message bubble"。
在消息气泡内,我有一个标签。如果单击消息气泡,标签的上下边距限制会扩大。
消息气泡上方有一个时间标签。
我收到此警告:
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.
2018-08-15 10:50:40.805762+0200 PipeTest[2521:879876] [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:0x1c0296670 V:[UILabel:0x102790380'Hehe']-(14)-| (active, names: '|':UIView:0x10278ff60 )>",
"<NSLayoutConstraint:0x1c02945f0 V:|-(14)-[UILabel:0x102790380'Hehe'] (active, names: '|':UIView:0x10278ff60 )>",
"<NSLayoutConstraint:0x1c0299780 UIView:0x102790b20.height == 27 (active)>",
"<NSLayoutConstraint:0x1c0296d00 UILabel:0x102773e60' 9 minutes ago'.height == 18 (active)>",
"<NSLayoutConstraint:0x1c02926b0 UIView:0x102790b20.bottom == UITableViewCellContentView:0x102784510.bottomMargin (active)>",
"<NSLayoutConstraint:0x1c02963a0 V:[UIView:0x10278ff60]-(7.67)-[UIView:0x102790b20] (active)>",
"<NSLayoutConstraint:0x1c0298a10 V:[UILabel:0x102773e60' 9 minutes ago']-(3)-[UIView:0x10278ff60] (active)>",
"<NSLayoutConstraint:0x1c0297070 UILabel:0x102773e60' 9 minutes ago'.top == UITableViewCellContentView:0x102784510.topMargin (active)>",
"<NSLayoutConstraint:0x1c0296760 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x102784510.height == 94 (active)>"
)
我做错了什么?
您已经定义了几个高度约束(尺寸)以及垂直约束。可能,你过度约束了。
按照提议,降低大部头垂直约束的优先级。
我尝试了所有方法,但找不到针对此警告的解决方案 XCode 向我抛出:
我有一个带有单元格的 tableView。
单元格是动态高度的,因为它们内部有视图:"message bubble"。
在消息气泡内,我有一个标签。如果单击消息气泡,标签的上下边距限制会扩大。
消息气泡上方有一个时间标签。
我收到此警告:
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.
2018-08-15 10:50:40.805762+0200 PipeTest[2521:879876] [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:0x1c0296670 V:[UILabel:0x102790380'Hehe']-(14)-| (active, names: '|':UIView:0x10278ff60 )>",
"<NSLayoutConstraint:0x1c02945f0 V:|-(14)-[UILabel:0x102790380'Hehe'] (active, names: '|':UIView:0x10278ff60 )>",
"<NSLayoutConstraint:0x1c0299780 UIView:0x102790b20.height == 27 (active)>",
"<NSLayoutConstraint:0x1c0296d00 UILabel:0x102773e60' 9 minutes ago'.height == 18 (active)>",
"<NSLayoutConstraint:0x1c02926b0 UIView:0x102790b20.bottom == UITableViewCellContentView:0x102784510.bottomMargin (active)>",
"<NSLayoutConstraint:0x1c02963a0 V:[UIView:0x10278ff60]-(7.67)-[UIView:0x102790b20] (active)>",
"<NSLayoutConstraint:0x1c0298a10 V:[UILabel:0x102773e60' 9 minutes ago']-(3)-[UIView:0x10278ff60] (active)>",
"<NSLayoutConstraint:0x1c0297070 UILabel:0x102773e60' 9 minutes ago'.top == UITableViewCellContentView:0x102784510.topMargin (active)>",
"<NSLayoutConstraint:0x1c0296760 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x102784510.height == 94 (active)>"
)
我做错了什么?
您已经定义了几个高度约束(尺寸)以及垂直约束。可能,你过度约束了。 按照提议,降低大部头垂直约束的优先级。