iOS8 - 约束模糊地表明高度为零 [英] iOS8 - constraints ambiguously suggest a height of zero
问题描述
有没有人知道如何调试这个?
Has anyone got any idea how to debug this?
仅警告一次:检测到约束模糊地表示高度为零的情况用于tableview单元格的内容视图。我们正在考虑无意中崩溃并使用标准高度。
Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead.
行具有固定高度,由
- (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 34.0;
}
所有约束
似乎很高兴......
And all the constraints
seem to be happy...
推荐答案
强制返回高度和估计高度使警告消失在我的情况下。
Forcing a return height and estimated height made the warning disappear in my case.
- (CGFloat)tableView:(UITableView *)tableView
estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 44;
}
- (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 44;
}
另一种不需要两次覆盖的解决方案就是使用<你的 loadView
或init方法中的code> self.tableView.rowHeight = 44; 。
Another solution where you don't need the two overrides is simply to use self.tableView.rowHeight = 44;
in your loadView
or init method.
这篇关于iOS8 - 约束模糊地表明高度为零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!