RDVTabBarController icon indicating copy to clipboard operation
RDVTabBarController copied to clipboard

how can i change the tabbarItem's icon tintColor?

Open 304164084 opened this issue 5 years ago • 0 comments

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;

}`

304164084 avatar Nov 28 '18 09:11 304164084