title: UITabBarController delegate methods never get called
body: <p>I'm currently refactoring my iPad application and instead of a button on the NavigationBar, I would like to put my Logout button as a TabBar button item.</p>
  
  <p>All of my views are in a unique StoryBoard so I get my TabBar in my Appdelegate.m by this way :</p>
  
  <pre><code>// Add logout tab to tabbar
  storyboard                      = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
  UITabBarController *tabbar      = (UITabBarController *)[storyboard instantiateViewControllerWithIdentifier:@"tabbar"];
  [tabbar setDelegate:self];
  </code></pre>
  
  <p>Of course the delegate protocol is declared in my Appdelegate.h</p>
  
  <pre><code>@interface AppDelegate : UIResponder &lt;UIApplicationDelegate, UITabBarControllerDelegate&gt;
  </code></pre>
  
  <p>After that, I create an empty viewController in order to create my logout tab :</p>
  
  <pre><code>UIViewController *logout        = [[UIViewController alloc]init];
  </code></pre>
  
  <p>Then I get tabbar viewControllers as NSMutableArray and add my logout VC :</p>
  
  <pre><code>NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:[tabbar viewControllers]];
  
  [viewControllers addObject:logout];
  </code></pre>
  
  <p>Finally I set tabbar viewControllers with my new array :</p>
  
  <pre><code>[tabbar setViewControllers:viewControllers];
  </code></pre>
  
  <p>I think that those steps are correct. 
  So why does the didSelectViewController is not called when I change the displayed tab ?</p>
  
  <p>If it can help, here's my didSelectViewController method (which is write in AppDelegate.m)</p>
  
  <pre><code>- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
      NSLog(@"onglet sélectionné : %d / %d", [tabBarController selectedIndex], [[tabBarController viewControllers]count]);
      //select the index where your logout button is
      if ([tabBarController selectedIndex] == [[tabBarController viewControllers]count]-1) {
          NSLog(@"logout");
      }
  }
  </code></pre>
  
  <p>Thanks in advance for your help !</p>