Search code examples
objective-ciosuitabbar

When I change the color of UITabBar it only shows up in gray


I'm using the following code in 'viewDidLoad' of the various view controllers of my tabbed app.

    UIColor *tabBarColor = [UIColor colorWithRed:85.1 green:57.6 blue:71.4 alpha:.5];
    [[UITabBar appearance] setTintColor:tabBarColor];

But the image that I get, which ought to be pink, is this:

enter image description here

I can make it lighter or darker by changing the alpha, but never colored--only black/white/gray.

Any thoughts about how I can solve this problem?


Solution

  • Under header files in .m write this line #define RGB(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1] now where you are setting color put this code for pink color [[UITabBar appearance] setTintColor:RGB(255, 192, 203)]; that's all