检测到约束模棱两可地暗示高度为零的情况 [英] Detected a case where constraints ambiguously suggest a height of zero

查看:20
本文介绍了检测到约束模棱两可地暗示高度为零的情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行包含 tableview 单元格的应用程序更新到 Xcode 6.1 beta 2 后,调试助手说:

After updating to Xcode 6.1 beta 2 when I run my app that contains tableview cells, the debug assistant says:

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.

之前,当我在这个项目中使用 Xcode 5 时,我会遇到一些错误,但自从我升级后这些错误都消失了.我现在没有其他错误或警告.我已经尝试调整所有 tableview 单元格的大小,也尝试使用标准高度,但我仍然收到相同的警告:

Before, when I used Xcode 5 on this project, I would get a few errors but those have gone away since I upgraded. I have no other errors or warnings now. I have already tried adjusting the sizes of all the tableview cells and also tried using standard height but I still get the same warning:

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.

我也通读了所有与此相关的类似主题,但他们的解决方案都没有帮助.当我使用模拟器测试该应用程序时,该应用程序运行良好,但应该在 tableView 单元格中的图片不存在.

I have also read through all similar topics on this but none of their solutions help. When I test the app with the simulator, the app runs fine except the pictures that are supposed to be in the tableView cells aren't there.

推荐答案

到目前为止,通过三件事已经成功地消除了这个警告.您可以选择最方便的.不过没什么好看的.

Three things have managed to silence this warning so far. You can pick up the most convenient for you. Nothing pretty though.

  • 在 viewDidLoad 中设置默认单元格的高度

  • To set up default cell's height in viewDidLoad

self.tableView.rowHeight = 44;

  • 转到故事板并将 tableview 上的行高更改为 44 以外的值.

  • Go to storyboard and change row height on your tableview to something different than 44.

    实现tableview的delegate方法heightForRowAtIndexPath

    To implement tableview's delegate method heightForRowAtIndexPath

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

  • 奇怪.

    这篇关于检测到约束模棱两可地暗示高度为零的情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆