// // AS_TabBarViewController.m // Asteria // // Created by 王猛 on 2023/5/6. // // #import "AS_TabBarViewController.h" #import #import "AViewController.h" @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:@{}]; UIViewController *cartv = [CTMediator.sharedInstance Cart_MyCartC:@{}]; 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]) { [Fuction_Tool pop_toLoginVC]; return false; } // else { // dispatch_async(dispatch_get_main_queue(), ^{ // [ASUserInfoManager.shared getInfo]; // }); // } }else if ([vc isKindOfClass:[[CTMediator.sharedInstance Cart_MyCartC:@{}] class]]){ if (![ASUserInfoManager.shared isLogin]) { [Fuction_Tool pop_toLoginVC]; return false; } } } return true; } @end