Has anyone got any idea how to debug this?
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.
The rows have a fixed height as set by
- (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 34.0;
}
And all the constraints
seem to be happy...
There appears to be a bug in XCode 6.1 that causes this problem if using auto-layout and you don't specify a value for the Row Height for each Table View Cell, but instead you leave the "default" value. Simply checking the "Custom" checkbox next to the Row Height, for every cell, makes the warning go away.
Yes, You get all constrains "happy" even in case when you only have horizontal constrains for items in table view cell. I had same issue. You need to add also vertical constrains. Doing so, that warning will go away.
The constraints can be happy for the purpose of layout, but not happy for the purpose of automatic row height. A happy layout would mean the content can be laid out without ambiguity. That would satisfy the checks in Interface Builder.
A happy layout for automatic row height would mean that, in addition to the above, you're also including constraints to the bottom of the cell.
More here: Detected a case where constraints ambiguously suggest a height of zero
You can use AutoLayout to calculate the right height for you. Here is a nice post about Dynamic Cell Height on iOS 8: http://natashatherobot.com/ios-8-self-sizing-table-view-cells-with-dynamic-type/
In my case, it is because I'm designing the cell with xib, and I forget to add that xib file to the target.
After I add that xib file to the target, the problem is gone
There are two important things happening here, I think.
1) It's super easy to make the constraints wrong if you're ctrl+dragging. So, double check that you have it done correctly. Best to use the tray on the left side of the screen to draw these constraints.
2) Instead of specifying the estimatedRowHeight in ViewDidLoad or somewhere else, use the delegate method
This fixed the problem right away for me.