title: Programmatically get index of a ViewController in the TabBar
body: <p>How do you programmatically get the index in the tab bar (starts at 0 for leftmost tab) of a view controller, from within the View Controller File. </p>
  
  <p>I am switching views with this:</p>
  
  <pre><code>[self.tabBarController setSelectedIndex:nextIndex];
  </code></pre>
  
  <p>and I want to be able to just set:</p>
  
  <pre><code>int nextIndex = currentIndex++;
  </code></pre>
  
  <p>How do I get that Current Index?</p>
  
  <p>EDIT: All three of the below answers are correct, thanks guys. To be fair I will choose the one that was posted first. </p>