Permalink
Browse files

added the ability to programmly select a tab

  • Loading branch information...
1 parent 521cdbe commit d9d72fc81c66bfa37a1bb19b4bf4057cd29b97dc @luosky committed Oct 31, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −1 NGTabBarController/NGTabBarController.h
  2. +4 −0 NGTabBarController/NGTabBarController.m
View
2 NGTabBarController/NGTabBarController.h
@@ -47,5 +47,5 @@
- (id)initWithDelegate:(id<NGTabBarControllerDelegate>)delegate;
- (void)setTabBarHidden:(BOOL)tabBarHidden animated:(BOOL)animated;
-
+- (void)selectTabAtIndex:(NSInteger)index;
@end
View
4 NGTabBarController/NGTabBarController.m
@@ -660,6 +660,10 @@ - (void)setupTabBarForPosition:(NGTabBarPosition)position {
- (void)handleItemPressed:(id)sender {
NSInteger index = [self.tabBarItems indexOfObject:sender];
+ [self selectTabAtIndex:index];
+}
+
+- (void)selectTabAtIndex:(NSInteger)index{
BOOL shouldSelect = [self delegatedDecisionIfWeShouldSelectViewController:[self.viewControllers objectAtIndex:index] atIndex:index];
if (shouldSelect) {

0 comments on commit d9d72fc

Please sign in to comment.