Question

I'm trying to show a tableviewcontroller as the first page, with the tabbarcontroller in it. After it is shown I would like to change the action of the first item in the tabbarcontroller to show a menu.

I have created the menu, I only need to find a way to change the click event of the first item on the tabbarcontroller.

I've been searching for hours now, and help would be greatly appreciated!

Thanks in advance, Tommy

*edit: I found the solution, I will post it tomorrow!

Was it helpful?

Solution 2

I found out a good way to handle this problem...

I used the UITabBarController delegate and implemented this:

 - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
  if([viewController.title isEqualToString:@"YourTitleHere"])
  {
     // do your stuff here
  }else
  {
     return YES;
  }
}

this Worked great for me, very happy that I finally found a solution! Hope this helps others as well!

OTHER TIPS

Implement

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{ if(tabBar.selectedItem.tag == 0) { RootViewController *objRootViewController = [[RootViewController alloc]init]; [self.navigationController pushViewController:objRootViewController animated:YES]; [objRootViewController release]; } }

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top