Detected a case where constraints ambiguously suggest a height of zero

后端 未结 23 711
猫巷女王i
猫巷女王i 2020-12-07 09:31

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 constr         


        
23条回答
  •  攒了一身酷
    2020-12-07 10:18

    In my case, I was building the cell programmatically and kept getting this error.

    I was adding the subviews and constraints in the UITableViewCell's init method like this:

    addSubview(rankingLabel)
    addConstraints(cellConstraints)
    

    I solved the issue by adding them to the cell's contentView instead:

    contentView.addSubview(rankingLabel)
    contentView.addConstraints(cellConstraints)
    

提交回复
热议问题