title: iOS Detecting Whether Tab is Changed
body: <p>I have tabbed iOS application. I need to know which tab is active and detect when tab is changed. In storyboard I have a tab view controller, which changes the view when you click a tab fine. I created a class <code>TabBarController</code> and it is defined as follows:</p>
  
  <p>Header</p>
  
  <pre><code>@interface TabBarController : UITabBarController &lt;UITabBarControllerDelegate&gt;
  
  @end
  </code></pre>
  
  <p>Implementation</p>
  
  <pre><code>#import "TabBarController.h"
  
  @implementation TabBarController
  
  // In the initialization section, set the delegate
  - (id) init
  {
      self = [super init];
      if (self) 
      {
          self.delegate = self;
      }
      return self;
  }
  
  - (void)tabBarController:(UITabBarController *)tabBarController 
   didSelectViewController:(UIViewController *)viewController
  {
      NSLog(@"controller class: %@", NSStringFromClass([viewController class]));
      NSLog(@"controller title: %@", viewController.title);
  }
  
  @end
  </code></pre>
  
  <p>However, I couldn't detect tab changes with the code above. What do you think that the problem is?</p>
  
  <p>I haven't linked my tab view to any outlets, but segues to other views. Is this the problem? Then, where should I link my outlet to?</p>