title: UISegmentedControl Best Practice
body: <p>I'm trying to work out the "best" way to use a <code>UISegmentedControl</code> for an iPhone application.  I've read a few posts here on stackoverflow and seen a few people's ideas, but I can't quite sort out the best way to do this.  The posts I'm referring to are:</p>
  
  <p><a href="https://stackoverflow.com/questions/1559794/changing-views-from-uisegmentedcontrol">Changing Views from UISegmentedControl</a>
  and
  <a href="https://stackoverflow.com/questions/1047114/how-do-i-use-a-uisegmentedcontrol-to-switch-views">How do I use a UISegmentedControl to switch views?</a></p>
  
  <p>It would seem that the options are:</p>
  
  <ul>
  <li>Add each of the views in IB and lay them out on top of each other then show/hide them</li>
  <li>Create each of the subviews separately in IB, then create a container in the main view to populate with the subview that you need</li>
  <li>Set up one really tall or really wide <code>UIView</code> and animate it left/right or up/down depending on the selected segment</li>
  <li>Use a <code>UITabBarController</code> to swap out the subviews - seems silly</li>
  <li>For tables, reload the table and in <code>cellForRowAtIndex</code> and populate the table from different data sources or sections based on the segment option selected (not the case for my app)</li>
  </ul>
  
  <p>So which approach is best for subview/non-table approaches?  Which is the easiest to implement?  Could you share some sample code to the approach?</p>
  
  <p>Thanks!</p>