Skip to content

Commit

Permalink
Scroll to the current session instead of just scrolling to the top
Browse files Browse the repository at this point in the history
  • Loading branch information
zats committed Mar 6, 2018
2 parents 89f026b + a66a66e commit 4863c93
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion trySwift/RootTabBar/RootTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ class RootTabBarController: UITabBarController, UITabBarControllerDelegate {
scrollableToTop.scrollAfterTabTap()
// or we find the topmost scroll view and scroll it to the top
} else {
firstController.view.findScrollSubview()?.setContentOffset(.zero, animated: true)
if let firstController = navigationController.viewControllers.first {
if let scrollableToTop = firstController as? ScrollableToTop {
scrollableToTop.scrollAfterTabTap()
} else {
firstController.view.findScrollSubview()?.setContentOffset(.zero, animated: true)
}
}
}
}
}
Expand Down

0 comments on commit 4863c93

Please sign in to comment.