UINavigationBar和UISearchBar都有一个tintColor属性,它允许您更改这两个项目的色调 colored颜色 (我知道,这很令人惊讶).我想对应用程序中的UITabBar执行相同的操作,但现在已经找到了将其从默认的黑色更改为其他 colored颜色 的方法.有什么主意吗?
UINavigationBar和UISearchBar都有一个tintColor属性,它允许您更改这两个项目的色调 colored颜色 (我知道,这很令人惊讶).我想对应用程序中的UITabBar执行相同的操作,但现在已经找到了将其从默认的黑色更改为其他 colored颜色 的方法.有什么主意吗?
我已经能够通过对UITabBarController进行子类化并使用私有类来实现它:
@interface UITabBarController (private)
- (UITabBar *)tabBar;
@end
@implementation CustomUITabBarController
- (void)viewDidLoad {
[super viewDidLoad];
CGRect frame = CGRectMake(0.0, 0.0, self.view.bounds.size.width, 48);
UIView *v = [[UIView alloc] initWithFrame:frame];
[v setBackgroundColor:kMainColor];
[v setAlpha:0.5];
[[self tabBar] addSubview:v];
[v release];
}
@end