diff --git a/BeeFramework/MVC/View/Bee_UITabBar.h b/BeeFramework/MVC/View/Bee_UITabBar.h index 649eb39..29f3c2e 100644 --- a/BeeFramework/MVC/View/Bee_UITabBar.h +++ b/BeeFramework/MVC/View/Bee_UITabBar.h @@ -64,7 +64,9 @@ AS_SIGNAL( HIGHLIGHT_CHANGED ) // 高亮改变 - (void)addTitle:(NSString *)title image:(UIImage *)image; - (void)addTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag; - (void)addTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag signal:(NSString *)signal; - + //zhouxl 取消item的徽章 设置item的徽章,在tabbar加载完成显示出来时设置 +- (void)clearBadgeValueOnIndex:(NSInteger)index; +- (void)setBadgeValue:(NSInteger)value onIndex:(NSInteger)index; @end #endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) diff --git a/BeeFramework/MVC/View/Bee_UITabBar.m b/BeeFramework/MVC/View/Bee_UITabBar.m index c617f0c..08e086e 100644 --- a/BeeFramework/MVC/View/Bee_UITabBar.m +++ b/BeeFramework/MVC/View/Bee_UITabBar.m @@ -198,6 +198,7 @@ - (void)setSelectedIndex:(NSInteger)index UITabBarItem * item = [_barItems objectAtIndex:index]; [self setSelectedItem:item]; + [self clearBadgeValueOnIndex:index];//zhouxl [self tabBar:self didSelectItem:item]; } else @@ -243,7 +244,26 @@ - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item withObject:[NSNumber numberWithInt:item.tag]]; } } + //zhouxl-> +- (void)clearBadgeValueOnIndex:(NSInteger)index{ + ((UITabBarItem* )[self.items objectAtIndex:index]).badgeValue = nil; +} +- (void)setBadgeValue:(NSInteger)value onIndex:(NSInteger)index{ + NSString* valueStr = [NSString stringWithFormat:@"%d",value]; + if (index<0 || index>= _barItems.count) { + BeeLog(@"tabbar :the index is out!"); + }else if(value == 0){ + ((UITabBarItem* )[self.items objectAtIndex:index]).badgeValue = nil; + }else if(value < 0){ + BeeLog(@"the value below 0!!!"); + }else + { + ((UITabBarItem* )[self.items objectAtIndex:index]).badgeValue = valueStr; + } + +} + //<-zhouxl @end #endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) diff --git a/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.m b/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.m index 1517dd6..fce8bc2 100644 --- a/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.m +++ b/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.m @@ -65,7 +65,7 @@ - (void)showNavigationBarAnimated:(BOOL)animated { [self.navigationController setNavigationBarHidden:NO animated:animated]; } - + //隐藏navBar - (void)hideNavigationBarAnimated:(BOOL)animated { [self.navigationController setNavigationBarHidden:YES animated:animated]; @@ -148,12 +148,19 @@ - (void)showBarButton:(NSInteger)position system:(UIBarButtonSystemItem)index - (void)showBarButton:(NSInteger)position custom:(UIView *)view { + //添加点击事件,zhouxl + UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc]init]; + view.userInteractionEnabled = YES; + [view addGestureRecognizer:tap]; if ( UINavigationBar.BARBUTTON_LEFT == position ) { + + [tap addTarget:self action:@selector(didLeftBarButtonTouched)]; self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:view] autorelease]; } else { + [tap addTarget:self action:@selector(didRightBarButtonTouched)]; self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:view] autorelease]; } } diff --git a/Example/Lessons/DribbbleBoard.m b/Example/Lessons/DribbbleBoard.m index 3f38a12..c86842b 100644 --- a/Example/Lessons/DribbbleBoard.m +++ b/Example/Lessons/DribbbleBoard.m @@ -166,7 +166,7 @@ - (void)handleUISignal_BeeUIBoard:(BeeUISignal *)signal if ( [signal is:BeeUIBoard.CREATE_VIEWS] ) { [self showNavigationBarAnimated:NO]; - [self showPullLoader:YES animated:NO]; + [self showPullLoader:YES animated:YES];//显示下拉时最上面的信息 self.pullLoader.arrow.image = [UIImage imageNamed:@"bug.png"]; diff --git a/Example/WhatsBug/AppDelegate.m b/Example/WhatsBug/AppDelegate.m index 9dc0d66..15b5fa5 100644 --- a/Example/WhatsBug/AppDelegate.m +++ b/Example/WhatsBug/AppDelegate.m @@ -23,6 +23,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; self.window.backgroundColor = [UIColor whiteColor]; +// 带navbar self.window.rootViewController = [BeeUIStackGroup stackGroupWithFirstStack:[BeeUIStack stackWithFirstBoard:[CatelogBoard board]]]; [self.window makeKeyAndVisible];