UITableView scrolls weirdly on reloadRows
Originator: | futuretap | ||
Number: | rdar://46806232 | Date Originated: | 18-Dec-2018 11:44 AM |
Status: | Open | Resolved: | |
Product: | iOS + SDK | Product Version: | 12.1.2 (16D5024a) |
Classification: | UI/Usability | Reproducible: | Always |
Summary: A UITableView with a large tableHeaderView shortly scrolls to a wrong contentOffset and back when reloading a row in a begin/endUpdates block. Steps to Reproduce: Build and run the attached sample project. Using the + button, add that many rows to the table that when scrolled all the way to the bottom, a small part of the tableHeaderView is still visible. (On an iPhone XS, 11 cells is a good number.) Scroll all the way to the bottom so that only a small part of the tableHeaderView is still visible. Now tap on the first cell to select it. This causes a reload of the cell in a begin/endUpdates block. Expected Results: The cell content should be reloaded but there should be no scrolling. Actual Results: It scrolls from a start contentOffset of {0, 287} to {0, 144} and {0, 105}, then back to {0, 287}. (I obtained the offset values by setting a breakpoint in `-[UITableView setContentOffset:]`.) Version: 12.1.2 (16D5024a) Notes: Included in the project, I've attached a screen video to show the issue. When removing the tableHeaderView, the issue does not occur anymore.
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!
Addendum 2
When disabling estimatedRowHeight and calculating rowHeight manually the issue does not occur anymore. So the bug seems to be involving row height estimation. https://github.com/futuretap/r46806232/tree/manualCellHeight
Addendum
I tried to replace the tableHeaderView with a large first cell of the same height. The issue also occurs. See https://github.com/futuretap/r46806232/tree/largeFirstCell
Sample project: https://github.com/futuretap/r46806232