Detected a case where constraints ambiguously suggest a height of zero

后端 未结 23 794
猫巷女王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:15

    I have this issue on TableViewCells where the constraints are set on initialisation but where the cell's contents are loaded afterwards, this means the autolayout engine can't determine the height. The other solutions here don't work because I need the cell's height to be UITableView.automaticDimension.

    I just added an extra constraint to the cell:

    contentView.heightAnchor.constraint(equalToConstant: 44, priority: .defaultLow)
    

提交回复
热议问题