// // AppDelegate+SPSBRootViewController.m // 我的社保 // // Created by shanp on 2021/4/20. // #import "AppDelegate+SPSBRootViewController.h" #import "SPSBGeneralManager.h" #import "SPSBTabBarView.h" #import "SPSBHomeViewController.h" #import "SPSBQueryHomeViewController.h" #import "SPSBConsultationViewController.h" #import "SPSBMineViewController.h" #import "SPSBNavigationController.h" #import #import "SPSBConstantProfile.h" #import "SPSBOpenPopupManager.h" #import "AppDelegate+SPSBPushNotification.h" @interface AppDelegate () @end @implementation AppDelegate (SPSBRootViewController) - (void)creatDefinedTabbar { spsb_homeNavVC(); spsb_queryHomeNavVC(); spsb_consultationHomeNavVC(); spsb_mineNavVC(); spsb_tabBarView().spsb_tabbarDelegate = self; } - (void)changeTabBarType:(SPSBTabBarType)type { [spsb_tabBarView() chooseTabBar:type]; } static bool _showHomePage = false; - (void)showHomePage { if (_showHomePage) return; _showHomePage = true; [self changeTabBarType:SPSBTabBarTypeHome]; [SPSBOpenPopupManager beginPopup]; } #pragma mark - tabBar代理 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation" - (void)tabBar:(SPSBTabBarView *)tabBar clickSameType:(SPSBTabBarType)type { switch (type) { case SPSBTabBarTypeHome: // [spsb_homeVC() topAction]; break; case SPSBTabBarTypeQuery: // [spsb_disabuseHomeVC() topAction]; break; case SPSBTabBarTypeConsultation: // [spsb_articleHomeVC() topAction]; break; case SPSBTabBarTypeMine: break; default: break; } } - (void)tabBar:(SPSBTabBarView *)tabBar clickType:(SPSBTabBarType)type { switch (type) { case SPSBTabBarTypeHome: { spsb_keyWindow().rootViewController = spsb_homeNavVC(); [spsb_homeNavVC().viewControllers.firstObject.view addSubview:spsb_tabBarView()]; } break; case SPSBTabBarTypeQuery: { spsb_keyWindow().rootViewController = spsb_queryHomeNavVC(); [spsb_queryHomeNavVC().viewControllers.firstObject.view addSubview:spsb_tabBarView()]; } break; case SPSBTabBarTypeConsultation: spsb_keyWindow().rootViewController = spsb_consultationHomeNavVC(); [spsb_consultationHomeNavVC().viewControllers.firstObject.view addSubview:spsb_tabBarView()]; break; case SPSBTabBarTypeMine: { spsb_keyWindow().rootViewController = spsb_mineNavVC(); [spsb_mineNavVC().viewControllers.firstObject.view addSubview:spsb_tabBarView()]; } break; default: break; } if (spsb_tabBarView().superview) { [spsb_tabBarView() remakeConstraints:^(JXHConstraintMaker *make) { make.leading.and.trailing.and.bottom.equalTo(0); make.top.equalTo(spsb_tabBarView().superview.safebottom).offset(-SPSBTabBarHeight); }]; } } #pragma clang diagnostic pop @end