0

In my app's delegate, I specify a transparent tool bar with (as suggested in an answer to question 18969248):-
The code is:

UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
navigationBarAppearance.backgroundColor = [UIColor clearColor];
[navigationBarAppearance setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
navigationBarAppearance.shadowImage = [[UIImage alloc] init];
navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];

This works for all view controllers pushed on to the navigation controller's stack, but not for the root view controller (which is loaded from a NIB). How can I get transparency in the root view controller's navigation bar?

09stephenb
  • 9,358
  • 15
  • 53
  • 91
user258279
  • 371
  • 4
  • 12

1 Answers1

0

Maybe you should load your RootViewController programmatically through your AppDelegate this way, if you're using storyboard :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"yourStoryboard"
                                                             bundle: nil];
    YourCustomRootViewController *customRootVC = (YourCustomRootViewController*) [mainStoryboard instantiateViewControllerWithIdentifier:@"firstAddProductViewController"];

    // If you're not using storyboard, simply instantiate it this way
    YourCustomRootViewController *customRootVC = [[YourCustomRootViewController alloc] initWithNibName:@"yourNib" bundle:nil];

    /* In here, you want to add the code relative to the navigation bar of your rootVC */
    [self.window setRootViewController:customRootVC];

}
Jissay
  • 550
  • 9
  • 28