Hide or remove a tab in tab based application in XCode

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

  1. macrumors newbie

    Joined:
    Dec 11, 2009
    #1
    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,
    Bala.
     
  2. macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #2
    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. thread starter macrumors newbie

    Joined:
    Dec 11, 2009
    #3
    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