Reading the topLayoutGuide property can cause scrollviews not to scroll

Originator:wvvwwvw
Number:rdar://16205435 Date Originated:Mar 1, 2014
Status:Open Resolved:
Product:iOS Product Version:
Classification: Reproducible:Always
 
Summary:
Simply reading the topLayoutGuide property on a view controller alters properties on the view in that view controller. Because of this, there are cases where it can cause the scrolling behaviour of table views to break.

Steps to Reproduce:
1. Create a subclass of UIViewController
2. In -[UIViewController loadView], create a UITableView and set the receiver's view property to be equal to this created table view. Also set up the view controller to be the data source and delegate of the table view, just to keep things simple.
3. In any method, but just for consistency with the docs, in -[UIViewController viewDidLayoutSubviews] call "self.topLayoutGuide". It doesn't matter what you do with the return type, just access the getter.
4. Make sure that your data source is returning enough cells to require scrolling, say 50.

Expected Results:
Expect the scroll view that makes up the table view to scroll to see all of the cells.

Actual Results:
When you try to scroll, observe that the table view can be pulled up, but as soon as you release it bounces back to the initial position, i.e. it cannot really be scrolled.

Version:
iOS 7

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!