Since I am developing an iOS >= 5.0 application, I am trying to change the appearance of the main UI components through the appearance proxies.
When dealing with the UITabBar
component, I correctly changed its tintColor
to a light shade of gray trough the [[UITabBar appearance] setTintColor:]
method. But doing this, the UITabBarItem
s included in the bar are quite impossible to see, since they retain the old gray/white color in their title label.
I tried to change their appearance through the [UITabBarItem appearance]
proxy, but there is no way to make them visible.
Can anyone suggest me a way to solve this problem? Thank you!
Hi this will work for what you want to do
// Customize the UIBarButtonItem
UIImage *button30 = [[UIImage imageNamed:@"button_textured_30"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
UIImage *button24 = [[UIImage imageNamed:@"button_textured_24"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
[[UITabBarItem appearance] setBackgroundImage:button30 forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UITabBarItem appearance] setBackgroundImage:button24 forState:UIControlStateNormal barMetrics:UIBarMetricsLandscapePhone];
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:82.0/255.0
green:82.0/255.0
blue:82.0/255.0
alpha:1.0], UITextAttributeTextColor,
[UIColor colorWithRed:242.0
green:237.0
blue:237.0
alpha:1.0], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0,1)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Helvetica" size:0.0], UITextAttributeFont,nil]
forState:UIControlStateNormal];
Happy Coding :)