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

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

问题描述

当我运行包含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;


  • 转到故事板并将桌面视图上的行高更改为不同于44的行。

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

    实现tableview的委托方法heightForRowAtIndexPath

    To implement tableview's delegate method heightForRowAtIndexPath

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


  • 很奇怪。

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

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