title: iOS TabBarController background color
body: <p>I have a tabbarcontroller that is pushed onto a navigationController. I tried to change the background color of the tab bar however it does not work:</p>
  
  <pre><code>    UIViewController *viewController1, *viewController2;
      if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
          viewController1 = [[Tab1_iPhone alloc] initWithNibName:@"tab1_iPhone" bundle:nil];
          viewController2 = [[Tab2_iPhone alloc] initWithNibName:@"tab2_iPhone" bundle:nil]; 
      } 
      self.tabBarController = [[UITabBarController alloc] init];
  
      CGRect frame = CGRectMake(0.0, 0.0, 480, 48);
      UIView *v = [[UIView alloc] initWithFrame:frame];
      [v setBackgroundColor:[UIColor blueColor]]; //003366
      [v setAlpha:1.0];
      [[self.tabBarController tabBar] insertSubview:v atIndex:0];
  
  
      self.tabBarController.viewControllers = [NSArray arrayWithObjects: viewController1, viewController2, nil];
      [self.navigationController setNavigationBarHidden:YES];
      [self.navigationController pushViewController:self.tabBarController animated:YES];
  
      [self.window makeKeyAndVisible];
  </code></pre>
  
  <p>This is the code I saw on a similar post that changes the bg color:</p>
  
  <pre><code>    CGRect frame = CGRectMake(0.0, 0.0, 480, 48);
      UIView *v = [[UIView alloc] initWithFrame:frame];
      [v setBackgroundColor:[UIColor blueColor]]; //003366
      [v setAlpha:1.0];
      [[self.tabBarController tabBar] insertSubview:v atIndex:0];
  </code></pre>
  
  <p>Am I doing something wrong?</p>
  
  <p>Thanks</p>