David E David E - 2 months ago 69
iOS Question

Detected a case where constraints ambiguously suggest a height of zero

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.


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.


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.

Answer

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

  • To set up default cell's height in viewDidLoad

    self.tableView.rowHeight = 44;
    
  • Go to storyboard and change row height on your tableview to something different than 44.

  • To implement tableview's delegate method heightForRowAtIndexPath

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

Weird.