使用内部 UIWebView 更新 tableview 单元格框架后的 AutoLayout 警告

AutoLayout warning after update tableview cell frame with UIWebView inside

我有一个自定义的 TableViewCell,里面有图像、标签和 webview,在计算 webview 大小后,我只更新加载 web 内容的单元格的高度。

(
"<NSLayoutConstraint:0x7ffa58c20680 UIImageView:0x7ffa58c1fe50.top == UILabel:0x7ffa588c9660'Nguy\U00ean Tuyen'.top>",
"<NSLayoutConstraint:0x7ffa58c20720 UILabel:0x7ffa588c9660'Nguy\U00ean Tuyen'.top == UITableViewCellContentView:0x7ffa588c94e0.topMargin>",
"<NSLayoutConstraint:0x7ffa58c20950 V:[UIImageView:0x7ffa58c1fe50]-(16)-[UIWebView:0x7ffa588c9ee0]>",
"<NSLayoutConstraint:0x7ffa58c20a90 V:[UIWebView:0x7ffa588c9ee0]-(NSSpace(8))-[UILabel:0x7ffa588c99d0'1 Tr\U1ea3 l\U1eddi']>",
"<NSLayoutConstraint:0x7ffa58c20ae0 UILabel:0x7ffa588c99d0'1 Tr\U1ea3 l\U1eddi'.bottom == UITableViewCellContentView:0x7ffa588c94e0.bottomMargin + 5>",
"<NSLayoutConstraint:0x7ffa58c295b0 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7ffa588c94e0(0.5)]>"

)

请告诉我如何解决这个问题! 谢谢。

AutoLayout警告有两种情况:

1.歧义

在这种情况下,没有足够的约束,因此 Interface Builder 无法解析子视图的位置或大小。

2。冲突

在这种情况下,约束太多了。您可以手动解决它们,也可以将不太必要的优先级从 1000 降低。 优先级小于 1000 的约束被认为是可选的。