christianroman / CRGradientNavigationBar

Custom UINavigationBar subclass which allows gradient coloured navigation bar on iOS 7.
MIT License
914 stars 116 forks source link

Double Navigation Bars #12

Open spiderguy84 opened 9 years ago

spiderguy84 commented 9 years ago

My app is a Tab Bar Controller app, in which each tab is a NavigationController. I have my code set as:

`UINavigationController *navigationController = [[UINavigationController alloc] initWithNavigationBarClass:[CRGradientNavigationBar class] toolbarClass:nil];

UIColor *firstColor = [UIColor colorWithRed:255.0f/255.0f green:42.0f/255.0f blue:104.0f/255.0f alpha:1.0f];
UIColor *secondColor = [UIColor colorWithRed:255.0f/255.0f green:90.0f/255.0f blue:58.0f/255.0f alpha:1.0f];

NSArray *colors = [NSArray arrayWithObjects:firstColor, secondColor, nil];
// or NSArray *colors = [NSArray arrayWithObjects:(id)UIColorFromRGB(0xf16149).CGColor, (id)UIColorFromRGB(0xf14959).CGColor, nil];

[[CRGradientNavigationBar appearance] setBarTintGradientColors:colors];
[[navigationController navigationBar] setTranslucent:NO]; // Remember, the default value is YES.

[navigationController setViewControllers:@[tabBarController]];

[self.window setRootViewController:navigationController];`

However, I am getting double navigation bars, with title and uibarbuttonitems being added to the 2nd, and not the gradient one. Any suggestions?

ios simulator screen shot jan 15 2015 9 56 47 am