title: Detect a re-tab on selected UITabbarItem
body: <p>I'm trying to detect a re-tab on the selected <code>UITabbarItem</code>. I'm using a <code>UIWebview</code> which url needs to be reset to the homepage again after re-tab on the Home button at index 1 in the UITabbar.</p>
  
  <p>Problem is: I'm using a storyboard and tried to make the <code>UITabbar</code> delegate, but it's not working. </p>
  
  <p>AppDelegate.h:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  @interface AppDelegate : UIResponder &lt;UIApplicationDelegate, UITabBarControllerDelegate&gt;
  @property (strong, nonatomic) UIWindow *window;
  @end
  </code></pre>
  
  <p>didLaunchWithOptions:</p>
  
  <pre><code>UITabBarController *tabController =
  (UITabBarController *)self.window.rootViewController;
  tabController.selectedIndex = [defaults integerForKey:kOptionLastTabSelectedKey];
  tabController.delegate = self;
  </code></pre>
  
  <p>It's giving the following error:</p>
  
  <pre><code>AppDelegate.m:26:36: Use of undeclared identifier 'defaults'
  </code></pre>
  
  <p>Then I need to detect if the tab has been re-tabbed, and if so, the UI webview must been reset to the homepage. So anyone a suggestion how to detect a re-tab on a specific tab? It's at index 1.</p>
  
  <p>I tried:</p>
  
  <pre><code>- (void)tabController:(UITabBarController*)tabController didSelectViewController:(UIViewController*)viewController
  {
  
      if (tabController.selectedViewController == viewController)
      {
          tabController.selectedIndex =0;
      }
  }
  </code></pre>