Hide or remove a tab in tab based application in XCode

Discussion in 'iOS Programming' started by balanetmail, Dec 11, 2009.

  1. balanetmail macrumors newbie

    Dec 11, 2009
    Hi Guys,

    I am very new to iphone and XCode i am trying to create a tab based application in that from the first page according to clicking of a button i need to remove/hide some of the tab added in the tabbar.
    Can any one help me out Plz.

    Thanks and Regards,
  2. KoolStar macrumors demi-god


    Oct 16, 2006
    The buttons on the tabbar are stored an an array, all you have to do is remove the button or add a button programmatically to the array in that event action.
  3. balanetmail thread starter macrumors newbie

    Dec 11, 2009
    Got the result

    Got it and i used the code like...

    NSUInteger indexToRemove = 3;
    NSMutableArray *controllersToKeep = [NSMutableArray arrayWithArray:tabBarController.viewControllers];
    UIViewController *removedViewController = [[controllersToKeep objectAtIndex:indexToRemove] retain];
    [controllersToKeep removeObjectAtIndex:indexToRemove];
    [tabBarController setViewControllers:controllersToKeep animated:YES];

    Thanks a lot KoolStar for your replay

    Now it is working....


Share This Page