UITable or when you assign a new data source. Reloading the table view clears current state, including the current selection. However, if you explicitly call
reload, it clears this state and any subsequent direct or indirect call to
layout does not trigger a reload.
If you assign a value to a table view’s
restoration property, it attempts to preserve the currently selected rows and the first visible row. The table’s data source may adopt the
UIData protocol, which provides a way to identify a row’s contents independent of that row’s position in the table. If the table’s data source adopts the
UIData protocol, the data source will be consulted when saving state to convert the index paths for the top visible row and any selected cells to identifiers. During restoration, the data source will be consulted to convert those identifiers back to index paths and reestablish the top visible row, and reselect the cells. If the table’s data source does not implement the
UIData protocol, the scroll position will be saved and restored directly, as will the index paths for selected cells.
For more information about how state preservation and restoration works, see App Programming Guide for iOS.