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 c
What can also be done is adding vertical constraints from the top and to the bottom of the content view. This will make autolayout happy (because he now knows how to calculate the height of the cell himself).
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/
If you're getting that warning, it's most likely because you're using auto layout and your cells don't have any constraints inside them.
You should either stop using auto layout or implement constraints that unambiguously define the height of the cells.
You can turn auto layout off in interface builder by unchecking the "Use Autolayout" option in the file inspector on the right.
If you choose to use auto layout and the height of your cells is fixed, implementing the appropriate constraints should be easy. Simply add height constraints for subviews of the cell's content view, and implement vertical space constraints between the subviews, and between the subviews and the content view. For example if your cell has one label in it, this would work:
Vertical constraints
Horizontal constraints
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
I've also seen this error when using universal storyboards or xibs. If you neglect to specify proper constraints for the Any x Any size class, I've seen this error appear.
Apple seems to have fixed this for iOS9. The error only happened on 8.4 for me.
Forcing a return height and estimated height made the warning disappear in my case.
- (CGFloat)tableView:(UITableView *)tableView
estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 44;
}
- (CGFloat)tableView:(UITableView *)tableView
heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 44;
}
Another solution where you don't need the two overrides is simply to use self.tableView.rowHeight = 44;
in your loadView
or init method.