Self-sizing table view cell not sized correctly for initial view load
||Product Version:||8 beta 5|
Using self-sizing table view cell with auto layout as described in WWDC 14 session 226. When the table view is first loaded the on screen cells are not sized correctly (see screenshot-A.png). Scrolling the table down and back to refresh the cells causes them to be redisplayed with the correct row height (see screenshot-B.png).
The table view is created in a storyboard and the estimatedRowHeight is set in viewDidLoad. In addition rowHeight is set to UITableViewAutomaticDimension. It would appear that the initial cells are sized with the rowHeight that is set in the Storyboard.
Steps to Reproduce:
1) Create a new Xcode project based on the single view app but use a single UITableViewController and custom UITableViewCell subclass
2) Configure the storyboard to contain the table view controller embedded in a root navigation controller.
3) Configure the table view prototype cell to use the custom table view class which should contain a single UILabel with auto layout constraints on the content view. The UILabel number of lines property should be set to 0 in interface builder.
4) Implement the minimal UITableViewDataSource delegate methods to populate the table view with some variable length text in the label of each cell.
5) In viewDidLoad set a value for the estimatedRowHeight property of the table view. Also ensure that rowHeight is set to UITableViewAutomaticDimension.
6) Build and run
The text label in each cell should contain the full amount of text without clipping. The text label should extend over multiple lines if required and the table view cell sized to fit. (screenshot-B.png)
On initial load the cells displayed on the screen are clipped and missing text due to the cell not being sized correctly. (screenshot-A.png)
Scrolling down to move those initial cells offscreen and then scrolling back up to cause the cells to be displayed again will show them correctly sized. (screenshot-B.png)
iOS 8 Beta 4
Example Xcode project to reproduce is attached
'SelfSize.zip', 'screenshot-A.png' and 'screenshot-B.png' were successfully uploaded.
Workaround: Add the following to viewDidAppear: in the table view controller to refresh the table view on initial load:
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!