title: Tap tab bar to Scroll to top of UITableViewController not always working
body: <p>I am trying to implement code that makes it so when I tap the tab bar item that is already selected, my tableview will scroll to the first row. I got this functionality to work most of the time by looking at other stack overflow answers; however, I noticed a weird behavior. For some reason if I never deselect the tab in the first place, the code does not work.</p>
  
  <p>For example, when I first load up the app, tab 0 is selected. If I scroll down and tap tab 0 again, it does not scroll to the top. However, if I select tab 1 and then tab 0, then proceed to scroll down and press tab 0 again, it scrolls up. Why is my code not working when the tab is selected for the first time?</p>
  
  <pre><code>func tabBarController(tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) {
    if viewController is UINavigationController {
      if navigationController == viewController {
        let topIndexPath = NSIndexPath(forRow: 0, inSection: 0)
        tableView.scrollToRowAtIndexPath(topIndexPath, atScrollPosition: .Top, animated: true)
      }
    }
  }
  </code></pre>