HurkNburkS HurkNburkS - 1 year ago 94
Objective-C Question

UIToolBar tintColor not working for ios7

I have created a

in my app that is colored blue, and it showed as blue when I was building it as a iOS 6 but now that I have updated the build to iOS 7 its turned white??

This is my code.

getProjectListToolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0, 20.0, screenHeight+20, 44)];
getProjectListToolBar.tintColor = [UIColor colorWithRed:85.0/255.0

getProjectListToolBar.translucent = NO;
getProjectListToolBar.layer.borderWidth = 0.0;
getProjectListToolBar.backgroundColor = [UIColor clearColor];
getProjectListToolBar.layer.borderWidth = 0.5;
getProjectListToolBar.layer.borderColor = [UIColor darkGrayColor].CGColor;
[self.view insertSubview:getProjectListToolBar aboveSubview:self.view];

Any help with getting it blue again would be appreciated.

Answer Source

You just need to set

getProjectListToolBar.translucent = NO;

In iOS 7 UITabBar and UINavigationBar has translucent property and for both you need to set translucent = NO , Its just for your information.


[getProjectListToolBar setBarTintColor:[UIColor colorWithRed:85.0/255.0 green:130.0/255.0 blue:186.0/255.0 alpha:1.0]];

Because in iOS 7 you need to set barTintColor instead of tintColor from this documentation.

I tried with your code in my demo project and it worked for me.