Dynamically sized UILabel in cell with numberOfLines = 0 truncates instead of showing multiple lines.

Originator:bruno
Number:rdar://20432181 Date Originated:2015-04-06
Status:Closed Resolved:Fixed in iOS 9 beta 1
Product:iOS SDK Product Version:8.2
Classification:UI/Usability Reproducible:Always
 
Summary:
In a UITableViewCell, a UILabel that is set up with constraints in Interface Builder to resize dynamically to accommodate multiple lines, instead truncates the text initially. 

If the section (not the specific row) is reloaded, the cell recalculates and shows the entire text in multiple lines. Reloading the section again, recalculates and sets the label back the wrong size. This can be repeated ad infinitum.

Strangely enough, the cell is large enough to accommodate the entire label, which leads me to believe it does actually calculate the appropriate size at some point.

Steps to Reproduce:
1. Run attached project.
2. Tap ‘Show UITableViewController’ button.
3. ‘Noodlewerk Apps’ title label shown at incorrect size.
4. Tap ‘Reload this section’ button.
5. ‘Noodlewerk Apps’ title label shown at *correct* size.
6. Go to step 3.

Expected Results:
The ‘Noodlewerk Apps’ title label should not change sizes and always show the entire text.

Actual Results:
The ‘Noodlewerk Apps’ title label initially appears at the incorrect size and truncates its text. Reloading the cell alternates the label between the correct and incorrect size.

Regression:
Unknown.

Notes:
Project is included in the accompanying zip file, along with two screenshots showing the correct and incorrect state. 
The same phenomenon can be seen in the sections below ‘About this company’, but the cell behaviour is different and under development.

Comments

Link to project

https://github.com/SpacyRicochet/TableViewWoes/tree/rdar20432181


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!