Reputation: 4520
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?
Upvotes: 7
Views: 1812
Reputation: 1
I encountered a similar issue. I was trying to create a bar chart using a third-party Chart library, but I forgot to assign my custom UIChartView class name in the storyboard. After adding the class name, the issue was resolved.
Xcode's error reporting really isn’t very accurate.
Upvotes: 0
Reputation: 296
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?
Upvotes: 16
Reputation: 1791
make sure you are using a static table . If you then remove methods as heightForFooterRow
make sure you autolayout, reset all and build app.
Upvotes: 0