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

标签 objective-c uitableview ios8 heightforrowatindexpath

有人知道如何调试吗?

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;

关于objective-c - iOS8 - 约束含糊地暗示高度为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25822324/

相关文章:

ios - Swift Closure 中的可选链接,其中返回类型必须为 Void

iphone - 如何仅在用户摇动 iPhone 时播放音频文件?

objective-c - IOS UIBarButtonItem 工作正常而 UIButton 导致无法识别的选择器发送到实例

ios - 如何在 iOS 中动态处理 tableviewCell 的高度?

ios - NSNotificationCenter 改变观察者顺序

iphone - iOS:框架放置不正确

ios - 如何使 uiscrollview 仅适用于 ios 的垂直滚动?

iOS8检查remotenotificationtype的权限

xcode - 不支持推送导航 Controller 错误消息

objective-c - UITableView 一次删除所有行