迅速约束警告

时间:2018-08-15 08:54:19

标签: swift constraints warnings

我尽了一切努力,但找不到针对XCode的警告警告解决方案:


我有一个带单元格的tableView。

这些单元格是动态高度,因为它们内部有一个视图:“消息气泡”。

在消息提示框内,我有一个标签。如果您单击消息气泡,则标签的上下边距约束将扩大。

消息气泡上方有一个时间标签。

我收到此警告:

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)>"
)

我在做什么错了?

1 个答案:

答案 0 :(得分:1)

您已经定义了几个高度限制(尺寸)以及垂直限制。可能您已经过度约束。 按照建议,降低书本垂直约束的优先级。