UITableViewController's table view can not scroll when calling topLayoutGuide in certain methods

Originator:michaelhochs
Number:rdar://17299546 Date Originated:13-Jun-2014
Status:Open Resolved:
Product:iOS SDK Product Version:7.1
Classification:UI Reproducible:Always
 
Summary:
When calling `self.topLayoutGuide` in a UITableViewController either in `scrollViewDidScroll:` or in `viewDidLayoutSubviews`, the table view will get a `contentSize` of 0,0, resulting in it not being able to scroll. It doesn't matter what you do with the resulting value of `topLayoutGuide`, it is enough to simply call this method.

Steps to Reproduce:
0. Build and Run the example project. See the comments in `ViewController.m`. Both lines lead to the behaviour, it doesn't matter if you comment out one of the lines.

-- or --

1. Create a UITableViewController subclass
2. Add some table view cell logic, so that the view controller displays enough cells that the table view should scroll
3. Override either `viewDidLayoutSubviews` or `scrollViewDidScroll:` (or both) and call `self.topLayoutGuide` in them
4. Build and Run the project

Expected Results:
The table view can be scrolled without any issues. All cells are visible.

Actual Results:
The table view can not be scrolled, it starts bouncing immediately.

Version:
iOS 7.0.6 / 7.1

Notes:


Configuration:
iPhone 5S, iOS 7.0.6 / iPhone Simulator 7.1 / Xcode 5.1.1 (5B1008)

Comments


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!