objective-c - iOS8 - 约束含糊地暗示高度为零

有人知道如何调试吗?

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;
}

而且所有的约束似乎都很开心...

最佳答案

在我的情况下,强制返回高度和估计高度会使警告消失。

- (CGFloat)tableView:(UITableView *)tableView 
           estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 44;
}

- (CGFloat)tableView:(UITableView *)tableView 
           heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 44;
}

另一个不需要这两个覆盖的解决方案是在 loadView 或 init 方法中简单地使用 self.tableView.rowHeight = 44;

https://stackoverflow.com/questions/25822324/

相关文章:

ios - 如何将度数转换为弧度?

ios - 带有透明孔的 CALayer

objective-c - iOS 7.0.3 上的 "HelveticaNeue-Italic"发

ios - UIAlertView 首先弃用 IOS 9

ios - 对 UITableView 使用 didSelectRowAtIndexPath 或 p

ios - 快速创建和播放声音

ios - 如何让 UILabel 显示轮廓文本?

objective-c - NSString 带\n 或换行符

ios - UICollectionViewCell 上的长按手势

ios - UICollectionView 当前可见单元格索引