Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add selector to programmatically select tab at index

  • Loading branch information...
commit da6e70e4d62b60d50e4640fa9eccce1362a38efd 1 parent 738bce0
@paularmstrong authored
View
3  AKTabBarController/AKTabBarController.h
@@ -99,4 +99,7 @@
- (void)willSwitchToViewController:(UIViewController *)viewController;
- (void)didSwitchToViewController:(UIViewController *)viewController;
+// jump to another tab
+- (void)selectTabAtIndex:(NSInteger)index;
+
@end
View
16 AKTabBarController/AKTabBarController.m
@@ -139,16 +139,9 @@ - (void)loadTabs
if (_tabTitleIsHidden)
[tab setTitleIsHidden:YES];
- // TODO: what's this do, exactly?
-// if ([(Class)obj isSubclassOfClass:[UINavigationController class]])
-// ((UINavigationController *)class).delegate = self;
-//
[tabs addObject:tab];
}];
- for (UIViewController *vc in self.viewControllers)
- {
- }
-
+
[tabBar setTabs:tabs];
// Setting the first view controller as the active one
@@ -175,6 +168,13 @@ - (NSArray *) selectedTabCGColors
return _selectedTabColors ? @[(id)[[_selectedTabColors objectAtIndex:0] CGColor], (id)[[_selectedTabColors objectAtIndex:1] CGColor]] : nil;
}
+#pragma mark - External Methods
+
+- (void)selectTabAtIndex:(NSInteger)index
+{
+ [self tabBar:tabBar didSelectTabAtIndex:index];
+}
+
#pragma - UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
Please sign in to comment.
Something went wrong with that request. Please try again.