title: Detect selected tabbar when switching tab bar
body: <p>I have three tab bar application and my tabs is TAB1, TAB2 , TAB3 i have write the following code in TAB1 view controller to detect which tab user have pressed</p>
  
  <pre><code>- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item 
  { 
      NSLog(@"tab selected: %@", item.title); 
  } 
  </code></pre>
  
  <p>But this delegate never get called</p>
  
  <p>i have setup my tab in appdelegate.m something like that</p>
  
  <pre><code>- (void)setupTabBar 
  {
      self.myWorkListViewController = [[MyWorkListViewController alloc] initWithNibName:@"MyWorkListViewController"
                                                                                 bundle:nil];
      self.askHRViewController = [[AskHRViewController alloc] initWithNibName:@"AskHRViewController"
                                                                       bundle:nil];
  
      self.moreViewController = [[MoreViewController alloc] initWithNibName:@"MoreViewController"
                                                                             bundle:nil];
  
      self.bookLeaveViewController = [[BookLeaveViewController alloc] initWithNibName:@"BookLeaveViewController"
                                                                               bundle:nil];
      self.helpViewController = [[HelpViewController alloc] initWithNibName:@"HelpViewController"
                                                                     bundle:nil];
  
      // Create navigation controllers
      workListNavigationController = [[UINavigationController alloc] initWithRootViewController:self.myWorkListViewController];
  
      askHRNavigationController = [[UINavigationController alloc] initWithRootViewController:self.askHRViewController];
  
      bookLeaveViewController = [[UINavigationController alloc] initWithRootViewController:self.bookLeaveViewController];
  
      moreNavigationController = [[UINavigationController alloc] initWithRootViewController:self.moreViewController];
  
      helpNavigationController = [[UINavigationController alloc] initWithRootViewController:self.helpViewController];
  
      [self setTabBarImagesAndText];
  
      // Setup tab bar controller
      self.tabBarController = [[UITabBarController alloc] init];
      [self.tabBarController setViewControllers:[NSArray arrayWithObjects:workListNavigationController, askHRNavigationController, bookLeaveViewController, helpNavigationController,moreNavigationController, nil]];
      //Set TabBar background
      [self.tabBarController.tabBar insertSubview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TabBar_iOS4_Background"]] atIndex:0];
      [self.tabBarController setSelectedIndex:0];
  
  }
  </code></pre>