Begin to page to a new index but then stop the gesture early so that the pager stays on the current index
Present and dismiss a view controller over the pager
The pager will now be at the index that you had started to move to, but not the index that you ended at.
Cause:
expectedTransitionIndex on PageboyViewController is set when the user begins the paging gesture, however, the expectedTransitionIndex is never cleared and the currentIndex is never updated if the user cancels the gesture. Therefore, when scrollToPage is triggered on viewWillAppear, the expectedTransitionIndex does not match the currentIndex and therefore the pager switches pages even though that is not the intention of the user.
Fix:
expectedTransitionIndex is set to nil at the end of the paging/scrolling process.
Issue Replication:
Cause: expectedTransitionIndex on PageboyViewController is set when the user begins the paging gesture, however, the expectedTransitionIndex is never cleared and the currentIndex is never updated if the user cancels the gesture. Therefore, when scrollToPage is triggered on viewWillAppear, the expectedTransitionIndex does not match the currentIndex and therefore the pager switches pages even though that is not the intention of the user.
Fix: expectedTransitionIndex is set to nil at the end of the paging/scrolling process.