title: Create uiTabBarController programmatically
body: <p>I want to create a <code>UIView</code> for a <code>UITabBarController</code></p>
  
  <p>Here is my code for the <code>.h</code> file : </p>
  
  <pre><code>@interface TE : UIViewController &lt;UITabBarControllerDelegate&gt;{
      UITabBarController *tabBarController;
  }
  @property (nonatomic,retain) UITabBarController *tabBarController;
  @end
  </code></pre>
  
  <p>The <code>viewDidLoad</code> method:</p>
  
  <pre><code>UIViewController *testVC = [[T1 alloc] init];
  UIViewController *otherVC = [[T2 alloc] init];
  NSMutableArray *topLevelControllers = [[NSMutableArray alloc] init];
  [topLevelControllers addObject: testVC];
  [topLevelControllers addObject: otherVC];
  tabBarController = [[UITabBarController alloc] init];
  tabBarController.delegate = self;
  [tabBarController setViewControllers:topLevelControllers animated:NO];
  tabBarController.selectedIndex = 0;
  self.view = tabBarController.view;
  </code></pre>
  
  <p>This creates the tab bar controller, but when I click on a tab bar item, I get an error:</p>
  
  <blockquote>
    <p>Thread1:Program receive signal: SIGABRT</p>
  </blockquote>
  
  <p><strong>Edit</strong>: I solved the problem by downloading and modifying the version of <a href="http://www.iphonedevcentral.com/create-uitabbarcontroller/" rel="nofollow noreferrer">http://www.iphonedevcentral.com/create-uitabbarcontroller/</a></p>