Open openradar-mirror opened 7 years ago
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Modified: 2017-10-06T22:07:15.484050
Description
Summary:
In iOS 10.3, it is possible to programmatically scroll to the bottom of a UITableView with any one of the following lines of code:
// assumes indexPathOfLastRow defined self.tableView.scrollToRow(at: indexPathOfLastRow, at: .bottom, animated: true)
self.tableView.scrollRectToVisible(CGRect(x: 0, y: self.tableView.contentSize.height - 1.0, width: 1.0, height: 1.0), animated: true)
self.tableView.setContentOffset(CGPoint(x: 0.0, y: self.tableView.contentSize.height), animated: true)
In iOS 11 and in current iOS 11.1 beta releases, these lines of code will scroll the table view to near the end but often not to the last cell or to the very end. I am attaching a sample project demonstrating the problem.
The attached sample project will reproduce the problem every time. Factors that appear to contribute to the problem are: • Fixed height cells and fixed height header views. • If using self-sizing cells and headers, headers and cells being taller than their estimated heights. • Large quantities of sections or cells. • Large heights of sections or cells. • Using animated: true. I can reproduce the issue with animated: false, but animated: true appears to exacerbate the issue.
Steps to Reproduce:
Expected Results:
After waiting 2 seconds, I expect the app to scroll to the bottom of the table or to the last cell in the table.
Actual Results:
On iOS 10.3, the app will scroll to the bottom of the table or to the last cell in the table as expected. On iOS 11 or iOS 11.1, the app will not scroll all the way to the bottom or to the very last cell.
Version/Build:
Xcode Version 9.1 beta (9B37), iOS 11.1 (15B5066f)
Configuration:
iPhone or Ipad, device or simulator.
===============
This is the sample code from the sample project I attached. It does not depend on any other classes, except that it needs code to instantiate and present this table view controller.
class TableViewController : UITableViewController {
// self.tableView.scrollRectToVisible(CGRect(x: 0, y: self.tableView.contentSize.height - 1.0, width: 1.0, height: 1.0), animated: true) // self.tableView.setContentOffset(CGPoint(x: 0.0, y: self.tableView.contentSize.height), animated: true) } }
}
- Product Version: Xcode Version 9.1 beta (9B37), iOS 11.1 (15B5066f) Created: 2017-10-06T22:02:05.512420 Originated: 2017-10-06T00:00:00 Open Radar Link: http://www.openradar.me/34865052