I have a table view with custom cells which contains several views piled one on top of the other and one of them is instantiated using a XIB file. In that XIB file, I have a UIImage and two UILabels I've encapsulated in a UIView. I've figured out already this is the source of my exception but I don't understand why. If I set hard-coded (instead of relative) constraints on the labels, i.e. fixed width and height it works.
I'm attaching a print screen that shows the constraints. Notice that in most constraints the constant = 0 otherwise it's stated in parentheses on the document outline. Also, the label's heights are 0.5 of their container's height.
Any clue to why it crashes?
Just encountered and fixed this problem for me. We had a UILabel in a UIView, and that UILabel's outlet was called title
. When we asked our cell to 'layoutIfNeeded', we got the UILabel length
exception. The -viewForBaselineLayout
method on UIView mentions the word title.
We changed the outlet so it was called "cellTitle" (anything but "title") and this crash goes away.
Can you try changing your outlet name?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With