Table view's scroll position changes on disappear when using estimated row heights

Originator:lithium3141
Number:rdar://19988438 Date Originated:27-Feb-2015 12:28 PM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 8.3 (12F5037c)
Classification:Other Bug Reproducible:Always
 
Summary:
In longer table views that use estimated row heights, selecting a row to push a new view controller onto a containing navigation controller can recalculate the table view's contentSize, causing a scroll position shift. In some situations, this can scroll the selected cell entirely offscreen, breaking the user's chain of navigation.

From debugging, it appears that the table view leaves and re-enters the window when the default navigation transition begins. UITableView's -didMoveToWindow then recomputes its contentSize based on the estimated row height; if this height times the number of rows is significantly different from the actual total height of the rows in question, the scroll position jumps by the difference.

Steps to Reproduce:
1. Launch the attached sample app on an iPhone in portrait.
2. Scroll all the way down.
3. Select the last row.
4. Navigate back.

Expected Results:
The last row is still entirely visible.

Actual Results:
The last row has been scrolled partially (or entirely) offscreen.

Note:
Sample app for this radar available at https://github.com/lithium3141/TableViewNavigationContentJump

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!