title: How to get selected TabBar item?
body: <p>I have went through some SO question and found this : </p>
  
  <pre><code>NSLog(@"selected tab index =&gt; %d",self.tabBarController.tabBar.selectedItem.tag);
  </code></pre>
  
  <p>However this is always return 0.
  What am I doing wrong?</p>
  
  <p>my code in AppDelegate :</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      // Override point for customization after application launch.
      // Assign tab bar item with titles
      UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
      UITabBar *tabBar = tabBarController.tabBar;
      UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
      UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
      UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];    
      return YES;
  }
  </code></pre>
  
  <p>Edit :</p>
  
  <p>I would like to do something like this :</p>
  
  <pre><code>if(self.tabBarController.tabBar.selectedItem.tag == 0)
  {
      [[UITabBar appearance] setSelectedImageTintColor:[UIColor orangeColor]];
  }   
  else     if(self.tabBarController.tabBar.selectedItem.tag == 1)
  {
      [[UITabBar appearance] setSelectedImageTintColor:[UIColor blueColor]];
  }   
  </code></pre>