I want to simulate the behavior of twitter or instagram in their list:
By double-clicking in UITabBarItem, the list scrolls up. Does anyone know how I can do this? I have 4 elements in my UITabBarController, all of them are a list, so I want to do this for everyone.
The problem is that when I click the bar element in the push view from the mi list, this function calls and detects a double click before getting the controller of the root navigation view.
I hope that with my problem it can be clear.
var previousController: UIViewController?
func tabBarController(tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) {
if previousController == viewController{
if let navVC = viewController as? UINavigationController, vc = navVC.viewControllers.first as? HomeViewController {
vc.tableBusinessList.setContentOffset(CGPointZero, animated: true)
print("same")
}
}else{
print("No same")
}
previousController = viewController
}
The behavior is wrong. When I exit a view using a tab bar item, the root view is on cell 0
