【发布时间】:2015-11-04 23:25:48
【问题描述】:
我的 xib 布局喜欢下图 除了“c”的高度常数之外,我还设置了从“a”到“b”到...“e”的约束,以便确定单元格的高度。 有时“c”会因为某些原因被隐藏,我将高度常数更改为零,并且在标签可见时将实际高度更改为标签的内容。
--------------------------------------
UILabel(name-singleline) a
UILabel(title-Multi line) b
UIView(hidden or not) c (default height constant = 80)
-UILabel(content Multi line) d
UILabel(singleline) e
--------------------------------------
但是有一个自动布局警告让我抓狂
(
"<NSLayoutConstraint:0x15756760 V:[UILabel:0x15756650'XXXX'(15)]>",
"<NSLayoutConstraint:0x15757130 V:[UIView:0x15756ee0(80)]>",
"<NSLayoutConstraint:0x15758060 V:|-(21)-[UILabel:0x15756650'XXXX'] (Names: '|':UITableViewCellContentView:0x157563a0 )>",
"<NSLayoutConstraint:0x15758120 V:[UILabel:0x15756650'XXXX']-(14)-[Project.GWWLabel:0x157573d0'YYYY']>",
"<NSLayoutConstraint:0x157581e0 V:[Project.GWWLabel:0x157573d0'YYYY']-(3)-[UIView:0x15756ee0]>",
"<NSLayoutConstraint:0x15758210 V:[UIView:0x15756ee0]-(8)-[UILabel:0x157569e0'ZZZZ']>",
"<NSLayoutConstraint:0x15758270 V:[UILabel:0x157569e0'ZZZZ']-(18)-| (Names: '|':UITableViewCellContentView:0x157563a0 )>",
"<NSLayoutConstraint:0x1575d760 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x157563a0(139.5)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x15757130 V:[UIView:0x15756ee0(80)]>
我也很想了解为什么会发生这种情况
【问题讨论】:
标签: ios objective-c iphone autolayout