fix: segmented control selection missing update issue

This commit is contained in:
CMK 2021-04-15 11:21:33 +08:00
parent 39c635705e
commit 12a3164a21
1 changed files with 5 additions and 0 deletions

View File

@ -625,6 +625,11 @@ extension ProfileViewController: ProfilePagingViewControllerDelegate {
func profilePagingViewController(_ viewController: ProfilePagingViewController, didScrollToPostCustomScrollViewContainerController postTimelineViewController: ScrollViewContainer, atIndex index: Int) {
os_log("%{public}s[%{public}ld], %{public}s: select at index: %ld", ((#file as NSString).lastPathComponent), #line, #function, index)
// update segemented control
if index < profileHeaderViewController.pageSegmentedControl.numberOfSegments {
profileHeaderViewController.pageSegmentedControl.selectedSegmentIndex = index
}
// save content offset
overlayScrollView.contentOffset.y = contentOffsets[index] ?? containerScrollView.contentOffset.y