如何解决TableViewCell约束冲突?

问题描述 投票:0回答:1

在一些表格单元动画期间,由于某种原因,左圆圈按钮开始中断自动布局

enter image description here

我在日志中收到以下错误

2020-01-28 22:09:56.581680-0500 Zenn[19786:13017249] [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:0x600000122670 UIButton:0x7f92b3c10520'Button'.height == 30   (active)>",
    "<NSLayoutConstraint:0x60000012d900 V:[UIStackView:0x7f92b3c18670]-(10)-|   (active, names: '|':UITableViewCellContentView:0x7f92b3c18cd0 )>",
    "<NSLayoutConstraint:0x60000012d810 V:|-(10)-[UIStackView:0x7f92b3c18670]   (active, names: '|':UITableViewCellContentView:0x7f92b3c18cd0 )>",
    "<NSLayoutConstraint:0x60000012eda0 'UISV-canvas-connection' UIStackView:0x7f92b3c1a970.top == UIButton:0x7f92b3c10520'Button'.top   (active)>",
    "<NSLayoutConstraint:0x60000012edf0 'UISV-canvas-connection' V:[UIButton:0x7f92b3c10520'Button']-(0)-|   (active, names: '|':UIStackView:0x7f92b3c1a970 )>",
    "<NSLayoutConstraint:0x60000012f1b0 'UISV-canvas-connection' UILayoutGuide:0x600001b17480'UIViewLayoutMarginsGuide'.top == Zenn.UITextViewCustom:0x7f92b4050c00'Www.google.com \n\n64768695...'.top   (active)>",
    "<NSLayoutConstraint:0x60000012f200 'UISV-canvas-connection' UILayoutGuide:0x600001b17480'UIViewLayoutMarginsGuide'.bottom == Zenn.UITextViewCustom:0x7f92b4050c00'Www.google.com \n\n64768695...'.bottom   (active)>",
    "<NSLayoutConstraint:0x60000012f250 'UISV-canvas-connection' UIStackView:0x7f92b3c18670.top == UIStackView:0x7f92b3c1a970.top   (active)>",
    "<NSLayoutConstraint:0x60000012fac0 'UISV-canvas-connection' V:[UIStackView:0x7f92b3c1d0b0]-(0)-|   (active, names: '|':UIStackView:0x7f92b3c18670 )>",
    "<NSLayoutConstraint:0x600000128050 'UISV-spacing' V:[UIStackView:0x7f92b3c1a970]-(0)-[UIStackView:0x7f92b3c1d0b0]   (active)>",
    "<NSLayoutConstraint:0x60000012efd0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600001b17480'UIViewLayoutMarginsGuide']-(8)-|   (active, names: '|':UIStackView:0x7f92b3c1d0b0 )>",
    "<NSLayoutConstraint:0x600000139c20 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7f92b3c18cd0.height == 50   (active)>",
    "<NSLayoutConstraint:0x60000012ef30 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600001b17480'UIViewLayoutMarginsGuide']   (active, names: '|':UIStackView:0x7f92b3c1d0b0 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600000122670 UIButton:0x7f92b3c10520'Button'.height == 30   (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.

似乎无法满足将按钮高度设置为30的要求。但是有什么矛盾呢?

enter image description here

ios uitableview autolayout constraints
1个回答
0
投票

仔细检查您的约束并为tableViewCell高度添加委托方法。

© www.soinside.com 2019 - 2024. All rights reserved.