我只有一个按钮的单元格,我已经添加了button = 30,top = 10和bottom = 10约束的高度,所以systemLayoutSizeFittingSize必须返回单元格高度= 50。返回50.5,我在日志中看到:UITableViewCell systemLayoutSizeFittingSize增加了额外的0.5 px
Will attempt to recover by breaking constraint
我正在使用分组表格视图和分隔符设置为无。哪里需要额外的0.5px?
代码片段:
[cell layoutSubviews];
return [cell systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;// 50;
日志:
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:0x7ffa71e273e0 V:[UIButton:0x7ffa71e24900'Book a new hotel'(30)]>",
"<NSLayoutConstraint:0x7ffa71e20bc0 V:|-(10)-[UIButton:0x7ffa71e24900'Book a new hotel'] (Names: '|':UITableViewCellContentView:0x7ffa71e06030)>",
"<NSLayoutConstraint:0x7ffa71e23ae0 UITableViewCellContentView:0x7ffa71e06030.bottomMargin == UIButton:0x7ffa71e24900'Book a new hotel'.bottom + 2>",
"<NSLayoutConstraint:0x7ffa705f6640 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7ffa71e06030(50.5)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7ffa71e273e0 V:[UIButton:0x7ffa71e24900'Book a new hotel'(30)]>
请你可以显示整个错误日志。它会显示正在发生的事情。 – Fogmeister
你的目标是iOS8吗? – Fogmeister
7+我知道有细胞高度在8 ..辉煌的解决方案..但我们需要7. – trickster77777