RDVTabBarController
RDVTabBarController copied to clipboard
how can i change the tabbarItem's icon tintColor?
Looking forward to your reply!!!
The final result is as follows:
`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
ViewController *vc1 = [[ViewController alloc] init];
ViewController *vc2 = [[ViewController alloc] init];
UITabBarController *tvc = [[UITabBarController alloc] init];
[tvc setViewControllers:@[vc1, vc2]];
[tvc.tabBar.items enumerateObjectsUsingBlock:^(UITabBarItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
NSString *title = [NSString stringWithFormat:@"vc->%ld", idx];
UIImage *selectedImage = [[UIImage imageNamed:@"tabbar_cate_highlight"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
UIImage *normalImage = [[UIImage imageNamed:@"tabbar_cate"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
obj.title = title;
obj.image = normalImage;
obj.selectedImage = selectedImage;
}];
[[UITabBar appearance] setTintColor:[UIColor redColor]];
[[UITabBar appearance] setUnselectedItemTintColor:[UIColor yellowColor]];
self.window.rootViewController = tvc;
[self.window makeKeyAndVisible];
return YES;
}`