HurkNburkS
HurkNburkS

Reputation: 5510

UIToolBar changes to black color when NavigationController changing views

I have changed the color of the UITooLBar, but now when it animates off screen it turns black for the duration of the animation and also when you go back to this view its still black.

I have been trying to figure out whats going on I know whats kind of going on but not why or how to fix.

What is weird is the UILabel I add to the toolbar is still there..

This is the code I am using to create the UIToolBar, and there is no other code refrencing this object.

seriesInfoToolBar = [UIToolbar new];
    [SeriesInfoToolBar sizeToFit];
    CGFloat toolbarHeight = 35;
    CGRect mainViewBounds = [[UIScreen mainScreen] applicationFrame];
    [SeriesInfoToolBar setFrame:CGRectMake(0, 0.0, CGRectGetWidth(mainViewBounds), toolbarHeight)];
    [SeriesInfoToolBar setTranslucent:NO];
    [SeriesInfoToolBar setBackgroundColor:[UIColor colorWithRed:colorController.lgRed/255.0 green:colorController.lgGreen/255.0 blue:colorController.lgBlue/255.0 alpha:1.0]];
    [[UIToolbar appearance] setBarTintColor:[UIColor colorWithRed:colorController.lgRed/255.0 green:colorController.lgGreen/255.0 blue:colorController.lgBlue/255.0 alpha:1.0]];

Upvotes: 3

Views: 525

Answers (1)

jailani
jailani

Reputation: 2270

If you set Translucent to NO on a toolbar with a translucent custom background image, the toolbar provides an opaque background for the image using black if the toolbar has UIBarStyleBlack style, white if the toolbar has UIBarStyleDefault, or the toolbar’s barTintColor if a custom value is defined.

Upvotes: 1

Related Questions