I have a UITableView with a segmented UIBarButtonItem on top, which I use to toggle the list's scope. The scope can either be ingredients or recipes, and the scope toggles the list's contents.
I want to preserve the scroll position independently in the two scopes, so that when switching back and forth, the list maintains its position. I achieve this by saving and restoring the tableView.contentOffset
value when toggling.
The problem I want to solve is related to scroll momentum: if the user scrolls "fast" and then toggles the scope, the momentum of the scroll is transferred to the other list, meaning that that list resumes the scroll.
How can I cancel the scroll when toggling scope?