I using TableView under Tab Bar My requirement is to scroll table view up when user double tap on tab bar item for selected view controller
this is my code
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool
{
if tabBarController.viewControllers!.index(of: viewController) == 0 {
if let navigationController = viewController as? UINavigationController{
if let streamController = navigationController.viewControllers.last as? StreamViewController
{
streamController.tableViewStream.setContentOffset(CGPoint(x: 0, y: 0), animated: false)
}
}
return true
}
}
But this is causing to scroll table up when user even single tap on item, due to this I am note able to retain scroll position.
So what I want is
1.If user scroll the table and go on another tab and come back again by single tap scroll position should remain same
2.If user tap double any time on tab tab bar item the list should be scroll to top