88
99#import " AppDelegate.h"
1010#import " CYLPlusButtonSubclass.h"
11- #import " HDLTabBarController .h"
11+ #import " MainTabBarController .h"
1212
1313@interface AppDelegate ()<UITabBarControllerDelegate, CYLTabBarControllerDelegate>
14- @property (nonatomic , strong ) HDLTabBarController *tabBarController;
14+ @property (nonatomic , strong ) MainTabBarController *tabBarController;
1515@property (nonatomic , weak ) UIButton *selectedCover;
1616
1717@end
@@ -26,26 +26,27 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2626 self.window = [[UIWindow alloc ]init];
2727 self.window .frame = [UIScreen mainScreen ].bounds ;
2828 [CYLPlusButtonSubclass registerPlusButton ];
29- HDLTabBarController *tabBarController = [[HDLTabBarController alloc ] init ];
29+ MainTabBarController *tabBarController = [[MainTabBarController alloc ] init ];
3030 [tabBarController hideTabBadgeBackgroundSeparator ];
31- [tabBarController setViewDidLayoutSubViewsBlock: ^(CYLTabBarController *tabBarController) {
32- if ([self cyl_tabBarController ].selectedIndex != 0 ) {
33- return ;
34- }
35- static dispatch_once_t onceToken;
36- UITabBar *tabBar = tabBarController.tabBar ;
37- for (UIControl *control in tabBar.subviews ) {
38- if ([control cyl_isTabButton ]) {
39- dispatch_once (&onceToken, ^{
40- NSUInteger delaySeconds = 0.2 ;
41- dispatch_time_t when = dispatch_time (DISPATCH_TIME_NOW, (int64_t )(delaySeconds * NSEC_PER_SEC));
42- dispatch_after (when, dispatch_get_main_queue (), ^{
43- [self setSelectedCoverShow: YES ];
44- });
45- });
46- }
47- }
48- }];
31+ // 添加仿淘宝tabbar,第一个tab选中后有图标覆盖
32+ // [tabBarController setViewDidLayoutSubViewsBlock:^(CYLTabBarController *tabBarController) {
33+ // if ([self cyl_tabBarController].selectedIndex != 0) {
34+ // return;
35+ // }
36+ // static dispatch_once_t onceToken;
37+ // UITabBar *tabBar = tabBarController.tabBar;
38+ // for (UIControl *control in tabBar.subviews) {
39+ // if ([control cyl_isTabButton]) {
40+ // dispatch_once(&onceToken, ^{
41+ // NSUInteger delaySeconds = 0.2;
42+ // dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delaySeconds * NSEC_PER_SEC));
43+ // dispatch_after(when, dispatch_get_main_queue(), ^{
44+ // [self setSelectedCoverShow:YES];
45+ // });
46+ // });
47+ // }
48+ // }
49+ // }];
4950 tabBarController.delegate = self;
5051 self.tabBarController = tabBarController;
5152 [self .window setRootViewController: tabBarController];
@@ -95,7 +96,6 @@ - (void)addOnceScaleAnimationOnView:(UIView *)animationView {
9596 [animationView.layer addAnimation: animation forKey: nil ];
9697}
9798
98-
9999- (void )customizeInterfaceWithTabBarController : (CYLTabBarController *)tabBarController {
100100 // 设置导航栏
101101 [self setUpNavigationBarAppearance ];
@@ -162,17 +162,16 @@ - (void)setUpNavigationBarAppearance {
162162
163163- (BOOL )tabBarController : (UITabBarController *)tabBarController shouldSelectViewController : (UIViewController *)viewController {
164164 [[self cyl_tabBarController ] updateSelectionStatusIfNeededForTabBarController: tabBarController shouldSelectViewController: viewController];
165- if ([viewController.tabBarItem.cyl_tabButton cyl_isTabButton ]|| [viewController.tabBarItem.cyl_tabButton cyl_isPlusButton ]) {
166- CGFloat index = [tabBarController.viewControllers indexOfObject: viewController];
167- BOOL shouldSelectedCoverShow = ( index == 0 ) ;
168- NSLog ( @" 🔴类名与方法名: %@ (在第 %@ 行),描述: %@ === %@ " , @(__PRETTY_FUNCTION__), @(__LINE__), tabBarController, @(tabBarController. selectedIndex ) );
169- [self setSelectedCoverShow: shouldSelectedCoverShow];
170- }
165+ // 添加仿淘宝tabbar,第一个tab选中后有图标覆盖
166+ // if ([viewController.tabBarItem.cyl_tabButton cyl_isTabButton]|| [viewController.tabBarItem.cyl_tabButton cyl_isPlusButton]) {
167+ // CGFloat index = [tabBarController.viewControllers indexOfObject:viewController] ;
168+ // BOOL shouldSelectedCoverShow = (index == 0 );
169+ // [self setSelectedCoverShow:shouldSelectedCoverShow];
170+ // }
171171
172172 return YES ;
173173}
174174
175-
176175- (void )tabBarController : (UITabBarController *)tabBarController didSelectControl : (UIControl *)control {
177176 UIView *animationView;
178177
0 commit comments