酷店

KDPTabBarVC.m 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // KDPTabBarVC.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/4.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPTabBarVC.h"
  9. #import "KDPLiveDataViewController.h"
  10. #import "KDPSupplyGoodViewController.h"
  11. #import "KDPMainNavViewController.h"
  12. @interface KDPTabBarVC ()
  13. @end
  14. @implementation KDPTabBarVC
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. [self addChildViewController:[[KDPTopViewController alloc]init] imgName:@"tab_top_un" SelectImgName:@"tab_top_s" title:@"首页"];
  18. [self addChildViewController:[[KDPSupplyGoodViewController alloc] init] imgName:@"tab_huoyuan_un" SelectImgName:@"tab_huoyuan_s" title:@"货源"];
  19. [self addChildViewController:[[KDPLiveDataViewController alloc] init] imgName:@"tab_live_un" SelectImgName:@"tab_live_s" title:@"直播数据"];
  20. [self addChildViewController:[[KDPEarnViewController alloc]init] imgName:@"tab_eringin_un" SelectImgName:@"tab_eringin_s" title:@"收益"];
  21. }
  22. -(void)addChildViewController:(UIViewController *)childV imgName:(NSString *)imgname SelectImgName:(NSString *)selectImgName title:(NSString *)title
  23. {
  24. [childV.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:ThemeColor]} forState:UIControlStateSelected];
  25. KDPMainNavViewController *nav =[[KDPMainNavViewController alloc]initWithRootViewController:childV];
  26. UIImage *image=[UIImage imageNamed:imgname];
  27. image=
  28. [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
  29. UIImage *selectImage=[UIImage imageNamed:selectImgName];
  30. selectImage=[selectImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
  31. childV.tabBarItem.selectedImage=selectImage;
  32. childV.tabBarItem.image=image;
  33. childV.tabBarItem.title = title;
  34. childV.title=title;
  35. childV.navigationItem.title = title;
  36. [self addChildViewController:nav];
  37. }
  38. @end