Double Clicking on UITabBarControllers Tab goes to root of Navigation controller

ぐ巨炮叔叔 提交于 2019-12-05 06:52:40

To do this you need to implement a function in your app delegate to pick up the tabbar delegate calls.

In your app delegate.m file, in the didfinishlaunching method, add this line

[tabBarController setDelegate:self];

then implement this method (also in your app delegate):

- (BOOL)tabBarController:(UITabBarController *)theTabBarController shouldSelectViewController:(UIViewController *)viewController
{
  return (theTabBarController.selectedViewController != viewController);
}

This gets called as part of the tab delegate protocol and will stop the selection of a tab if its already the selected one.

Hope that helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!