- Add the "MGSwipeTabBarController" Folder to your project
- import "MGSwipeTabBarControllerHeaders.h" in your project's "โฆ-Prefix.pch" file
There is a couple ways in setting up your SwipeTabBarController
Here is the way without a tabBar:
NSArray *viewControllers = . . . //your view controllers
MGSwipeTabBarController *tabController = [[MGSwipeTabBarController alloc] initWithViewControllers:viewControllers];
Here is the way with a tabBar:
NSArray *viewControllers = . . . //your view controllers
TabBar *customTabBar = . . . //your tab bar
MGSwipeTabBarController *tabController = [[MGSwipeTabBarController alloc] initWithViewControllers:viewControllers tabBar:tabBar];
Here is the way with a tabBar and a custom tabBar position
- Two options: MGTabBarPositionTop (Default) & MGTabBarPositionBottom
NSArray *viewControllers = . . . //your view controllers
TabBar *customTabBar = . . . //your tab bar
MGSwipeTabBarController *tabController = [[MGSwipeTabBarController alloc] initWithViewControllers:viewControllers tabBar:tabBar atPosition:MGTabBarPositionBottom];
- Subclass MGSwipeTabBar
- remember to call the delegate method "[self.delegate swipeTabBarDidSelectIndex:YOUR_SELECTED_INDEX]" when a button was selected in tabBar
- DO NOT call "[self.delegate swipeTabBarDidSelectIndex:YOUR_SELECTED_INDEX]" in setSelectedIndex:
Check out the Example Demo for a guide/example in subclassing MGSwipeTabBar (very simple, two method implementation)