Skip to content

Instantly share code, notes, and snippets.

@markSci5
Created August 19, 2013 05:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markSci5/6266019 to your computer and use it in GitHub Desktop.
Save markSci5/6266019 to your computer and use it in GitHub Desktop.
Manual tab switching
// Custom tab bar implementation from http://www.wiredbob.com/2009/04/iphone-tweetie-style//-navigation.html
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
if (item == favouritesTabBarItem) {
UIViewController *fabViewController = [viewControllers objectAtIndex:0];
[self.selectedViewController.view removeFromSuperview];
[self.view addSubview:fabViewController.view];
self.selectedViewController = fabViewController;
} else if (item == moreTabBarItem) {
UIViewController *moreViewController = [viewControllers objectAtIndex:1];
[self.selectedViewController.view removeFromSuperview];
[self.view addSubview:moreViewController.view];
self.selectedViewController = moreViewController;
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment