| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 | ////  AS_TabBarViewController.m//  Asteria////  Created by 王猛 on 2023/5/6.//  //#import "AS_TabBarViewController.h"#import <UCMBaseC.h>#import "AViewController.h"@interface AS_TabBarViewController ()<UITabBarControllerDelegate>@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<titleArr.count; i++) {        QMUINavigationController *uikitNavController = [[QMUINavigationController alloc] initWithRootViewController:vcAry[i]];        UITabBarItem *tabBarItem = [[UITabBarItem alloc] initWithTitle:titleArr[i] image:[UIImageMake(imgArr[i]) imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] tag:i];                if (i == 2) {            tabBarItem.qmui_badgeFont = [UIFont fontWithName:Rob_Regular size:11];            tabBarItem.qmui_badgeOffset = CGPointMake(-8, 13);            tabBarItem.qmui_badgeContentEdgeInsets = UIEdgeInsetsMake(3, 3, 3, 3);            tabBarItem.qmui_badgeInteger = 0;            tabBarItem.qmui_badgeTextColor = Col_FFF;            tabBarItem.qmui_badgeBackgroundColor = Col_000;        }        tabBarItem.selectedImage = [UIImageMake(selimgArr[i]) imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];        uikitNavController.tabBarItem = tabBarItem;        [tabvcAry addObject:uikitNavController];    }    self.viewControllers = tabvcAry;    self.delegate = self;}- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {//    if (self.tabBar.items.count > 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
 |