Search code examples
iosobjective-cuibuttonuitabbarcontrolleruitabbar

UIButton on tabbar


In my app I am making my app to tabbarcontroller by clicking a button in viewcontroller I want to add a UIButton at the place of Third tabbar button,how to do that? I have followed this tutorial(may be the best)-but not getting an idea

I am creating the tabbar like this

In ViewController.h

   @property (strong,nonatomic) IBOutlet UIViewController *myhomeVC,*groupVC,*uploadVC;
   @property (nonatomic,strong) NSMutableArray *Array;
   @property (strong,nonatomic) IBOutlet UINavigationController *homeNavBar,*groupNavBar,*uploadNavBar;

In ViewController.m

  -(IBAction)Login:(id)sender{




    Array = [[NSMutableArray alloc] initWithCapacity:5];


    myhomeVC = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
    homeNavBar=[[UINavigationController alloc]initWithRootViewController:myhomeVC];
    homeNavBar.tabBarItem.title=@"First";



    groupVC = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    groupNavBar=[[UINavigationController alloc]initWithRootViewController:groupVC];
    groupNavBar.tabBarItem.title=@"Second";

    uploadVC = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
    uploadNavBar=[[UINavigationController alloc]initWithRootViewController:uploadVC];
    uploadNavBar.tabBarItem.title=@"Third";


    [Array addObject:homeNavBar];
    [Array addObject:groupNavBar];
    [Array addObject:uploadNavBar];


    appDelegate.tabBarController.viewControllers = localViewControllersArray;

    [self.parentViewController.view setHidden:YES];



     appDelegate.window.rootViewController = appDelegate.tabBarController;


     }
     }

Solution

  • Why don't you go for GTabBar for your Project.? The Link for GTabBar.,, http://www.guerrillawebsitedesign.co.uk/wordpress/index.php/2010/09/30/how-to-create-a-custom-uitabbarcontroller-for-the-iphone-with-different-background-images-and-icons-part-1-2/