gpt4 book ai didi

ios - 自定义 TableViewCell 中 iOS 7 中的自动布局问题

转载 作者:行者123 更新时间:2023-11-29 02:13:32 25 4
gpt4 key购买 nike

我在 iOS 7 中遇到了自动布局自定义 TableViewCell 的问题。单元格显示正确,但我得到了大量的调试控制台输出,例如:

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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property
translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x7f9c1a4b8500 V:[UILabel:0x7f9c1a4b72d0]-(0)-[UILabel:0x7f9c1a4b7680]>",
"<NSLayoutConstraint:0x7f9c1a4b8550 V:[UILabel:0x7f9c1a4b7680]-(0)-[UILabel:0x7f9c1a488910]>",
"<NSLayoutConstraint:0x7f9c1a4b85c0 V:[UILabel:0x7f9c1a488910]-(NSSpace(20))-| (Names: '|':UITableViewCellContentView:0x7f9c1a4b66d0 )>",
"<NSLayoutConstraint:0x7f9c1a4b87f0 V:|-(NSSpace(20))-[UILabel:0x7f9c1a4b6f00] (Names: '|':UITableViewCellContentView:0x7f9c1a4b66d0 )>",
"<NSLayoutConstraint:0x7f9c1a4b8840 V:[UILabel:0x7f9c1a4b6f00]-(NSSpace(8))-[UILabel:0x7f9c1a4b72d0]>",
"<NSAutoresizingMaskLayoutConstraint:0x7f9c1a4a70e0 h=--& v=--& V:[UITableViewCellContentView:0x7f9c1a4b66d0(44)]>"
)

我只在 iOS 7 中获得此输出,并且我在跨多个 View Controller 的所有自定义表格 View 单元格中看到它。我已按照这篇文章中的所有步骤操作:( Using Auto Layout in UITableView for dynamic cell layouts & variable row heights )。我尝试调整这些单元格中内容 View 的 AutoresizingMask,但它并没有阻止这些错误的出现。我将不胜感激关于修复这些错误的一些建议。谢谢!

最佳答案

最后一个, “NSAutoresizingMaskLayoutConstraint:0x7f9c1a4a70e0 h=--& v=--& V:[UITableViewCellContentView:0x7f9c1a4b66d0(44)]”

可能表明在 tableviewcell 中,translatesAutoresizingMaskIntoConstraints 属性设置为 YES。如果是这种情况,请尝试将其设置为 NO 以避免您的约束与自动约束之间发生冲突。

关于ios - 自定义 TableViewCell 中 iOS 7 中的自动布局问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29017468/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com