// // AS_TabBarViewController.m // Asteria // // Created by 王猛 on 2023/5/6. // // #import "AS_TabBarViewController.h" #import #import "AViewController.h" @class APCategoryViewController; @interface AS_TabBarViewController () @end @implementation AS_TabBarViewController - (void)didInitialize { [super didInitialize]; self.tabBar.backgroundColor = UIColor.whiteColor; self.tabBar.unselectedItemTintColor = Col_666; self.tabBar.tintColor = _1CBC9D; UIViewController *vc1 = [[CTMediator sharedInstance] getCategoryListVc:@{}]; UIViewController *vc2 = [[CTMediator sharedInstance] getHomeVc:@{}]; AViewController *cartv = [AViewController new]; UIViewController *vc3 = [[CTMediator sharedInstance] getUserCenterVc:@{}]; NSArray *vcAry = @[vc2, vc1, cartv, vc3]; NSArray *titleArr = @[@"SHOP",@"CATEGORY",@"CART", @"ME"]; NSArray *imgArr = @[@"tab_home", @"tab_category", @"tab_cart",@"tab_me"]; NSArray *selimgArr = @[@"tab_home_sel", @"tab_category_sel",@"tab_cart_sel" , @"tab_me_sel"]; NSMutableArray *tabvcAry = [[NSMutableArray alloc]init]; for (int i= 0; i 2) { UITabBarItem *temp = self.tabBar.items[2]; temp.qmui_badgeInteger = arc4random()%100; } } - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController { if ([viewController isKindOfClass:QMUINavigationController.class]) { QMUINavigationController *nav = (QMUINavigationController *)viewController; UIViewController *vc = nav.qmui_rootViewController; if ([vc isKindOfClass:[CTMediator.sharedInstance categoryListVcClass]]) { UIViewController *vc1 = [[CTMediator sharedInstance] getCategoryListVc:@{}]; [self.selectedViewController pushViewController:vc1 animated:true]; return false; } if ([vc isKindOfClass:[CTMediator.sharedInstance userCenterVcClass]]) { if (![ASUserInfoManager.shared isLogin]) { UIViewController *loginC = [[CTMediator sharedInstance] Login_LoginC:@{}]; QMUINavigationController *uikitNavController = [[QMUINavigationController alloc] initWithRootViewController:loginC]; uikitNavController.navigationBar.hidden = YES; uikitNavController.modalPresentationStyle =UIModalPresentationFullScreen; [self.selectedViewController presentViewController:uikitNavController animated:YES completion:nil]; return false; } else { [ASUserInfoManager.shared getInfo]; } } } return true; } @end