AppDelegate+SPSBRootViewController.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // AppDelegate+SPSBRootViewController.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/4/20.
  6. //
  7. #import "AppDelegate+SPSBRootViewController.h"
  8. #import "SPSBGeneralManager.h"
  9. #import "SPSBTabBarView.h"
  10. #import "SPSBHomeViewController.h"
  11. #import "SPSBQueryHomeViewController.h"
  12. #import "SPSBConsultationViewController.h"
  13. #import "SPSBMineViewController.h"
  14. #import "SPSBNavigationController.h"
  15. #import <JXHLayout.h>
  16. #import "SPSBConstantProfile.h"
  17. #import "SPSBOpenPopupManager.h"
  18. #import "AppDelegate+SPSBPushNotification.h"
  19. @interface AppDelegate ()<SPSBTabBarViewDelegate>
  20. @end
  21. @implementation AppDelegate (SPSBRootViewController)
  22. - (void)creatDefinedTabbar {
  23. spsb_homeNavVC();
  24. spsb_queryHomeNavVC();
  25. spsb_consultationHomeNavVC();
  26. spsb_mineNavVC();
  27. spsb_tabBarView().spsb_tabbarDelegate = self;
  28. }
  29. - (void)changeTabBarType:(SPSBTabBarType)type {
  30. [spsb_tabBarView() chooseTabBar:type];
  31. }
  32. static bool _showHomePage = false;
  33. - (void)showHomePage {
  34. if (_showHomePage) return;
  35. _showHomePage = true;
  36. [self changeTabBarType:SPSBTabBarTypeHome];
  37. [SPSBOpenPopupManager beginPopup];
  38. }
  39. #pragma mark - tabBar代理
  40. #pragma clang diagnostic push
  41. #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
  42. - (void)tabBar:(SPSBTabBarView *)tabBar clickSameType:(SPSBTabBarType)type {
  43. switch (type) {
  44. case SPSBTabBarTypeHome:
  45. // [spsb_homeVC() topAction];
  46. break;
  47. case SPSBTabBarTypeQuery:
  48. // [spsb_disabuseHomeVC() topAction];
  49. break;
  50. case SPSBTabBarTypeConsultation:
  51. // [spsb_articleHomeVC() topAction];
  52. break;
  53. case SPSBTabBarTypeMine:
  54. break;
  55. default:
  56. break;
  57. }
  58. }
  59. - (void)tabBar:(SPSBTabBarView *)tabBar clickType:(SPSBTabBarType)type {
  60. switch (type) {
  61. case SPSBTabBarTypeHome: {
  62. spsb_keyWindow().rootViewController = spsb_homeNavVC();
  63. [spsb_homeNavVC().viewControllers.firstObject.view addSubview:spsb_tabBarView()];
  64. }
  65. break;
  66. case SPSBTabBarTypeQuery: {
  67. spsb_keyWindow().rootViewController = spsb_queryHomeNavVC();
  68. [spsb_queryHomeNavVC().viewControllers.firstObject.view addSubview:spsb_tabBarView()];
  69. }
  70. break;
  71. case SPSBTabBarTypeConsultation:
  72. spsb_keyWindow().rootViewController = spsb_consultationHomeNavVC();
  73. [spsb_consultationHomeNavVC().viewControllers.firstObject.view addSubview:spsb_tabBarView()];
  74. break;
  75. case SPSBTabBarTypeMine: {
  76. spsb_keyWindow().rootViewController = spsb_mineNavVC();
  77. [spsb_mineNavVC().viewControllers.firstObject.view addSubview:spsb_tabBarView()];
  78. }
  79. break;
  80. default:
  81. break;
  82. }
  83. if (spsb_tabBarView().superview) {
  84. [spsb_tabBarView() remakeConstraints:^(JXHConstraintMaker *make) {
  85. make.leading.and.trailing.and.bottom.equalTo(0);
  86. make.top.equalTo(spsb_tabBarView().superview.safebottom).offset(-SPSBTabBarHeight);
  87. }];
  88. }
  89. }
  90. #pragma clang diagnostic pop
  91. @end