title: Code Pattern: Loading TabBarController objects directly from independent .xib file (instead of from MainWindow.xib)
body: <p>I've looked around online, and haven't been able to find an acceptable solution to this problem...</p>
  
  <p>I'm looking for a simple code pattern:</p>
  
  <p><strong>Load a TabBarController object (with associated subview controllers) from a separate .xib file, instead of including and loading automatically from a default MainWindow.xib.</strong></p>
  
  <p>In XCode terms, starting from a new iPad/iPhone project as a "Tab Bar Application", the goal is to solve the following:</p>
  
  <ul>
  <li>Create the project</li>
  <li>Move: TabBarController, TabBar, FirstViewController, and SelectedSecondViewController from MainWindow.xib, into a new "TabBarController.xib" file</li>
  <li>After moving, MainWindow.xib should only contain: File's Owner, First Responder, App Delegate, Window</li>
  <li>In TabBarController.xib, File's Owner and First Responder are set to: UIApplication and UIResponder, respectively.</li>
  <li>Change "didFinishLaunchingWithOptions" in the main application delegate to the following:</li>
  </ul>
  
  <p>REMOVE:</p>
  
  <pre>
       [self.window addSubview:tabBarController.view];
  </pre>
  
  <p>ADD:</p>
  
  <pre>
       UITabBarController *uiTab = [[UITabBarController alloc] initWithNibName:@"TabBarController" bundle:nil]; 
       [self.window addSubview:uiTab.view];
  </pre>
  
  <p>With these changes, the application builds and runs, but when the TabBarController loads the tab bar is "empty" -- there don't appear to be any contents in the controller.</p>
  
  <p>In looking in the debugger, either the "init" isn't initializing from the data correctly, or something in the .xib file is not set correctly.</p>
  
  <p>What is the correct solution to this?  I realize there are other ways of doing this, and yes, I have them working in other applications.</p>
  
  <p>What I'm looking for however, <strong>is a specific solution using the default project, that can be used as a general pattern for setting up iOS code.</strong></p>
  
  <p>Thanks in advance for any help</p>
  
  <ul>
  <li>js</li>
  </ul>