scrollToRow(at:at:animated:)
Scrolls through the table view until a row that an index path identifies is at a particular location on the screen.
Declaration
func scrollToRow(at indexPath: IndexPath, at scrollPosition: UITableView.ScrollPosition, animated: Bool)Parameters
- indexPath:
An index path that identifies a row in the table view by its row index and its section index.
NSNotFoundis a valid row index for scrolling to a section with zero rows. - scrollPosition:
A constant that identifies a relative position in the table view (top, middle, bottom) for
rowwhen scrolling concludes. See Scrollposition for descriptions of valid constants. - animated:
True if you want to animate the change in position; False if it should be immediate.
Discussion
Invoking this method doesn’t cause the delegate to receive a scrollViewDidScroll(_:) message, as is normal for programmatically invoked user interface operations.