So, a UIViewController walks into a tabBar...

Discussion in 'iOS Programming' started by jchildress, Aug 11, 2008.

  1. jchildress macrumors member

    Jul 9, 2008
    ... and says to the tabBarController: "What do I have to do around here to get viewed"?

    OK, so I've got a UI problem where I can't seem to get a specific scenario to work. What I have is a 4 button TabBarController application that I created in xCode using New Project --> iPhone Application --> tabBar Application.

    In the first view that starts up (tabBar button 1), I have a grid of buttons that when one is pressed, is supposed to flip to a new view using the "UIViewAnimationTransitionFlipFromLeft" option. To further clarify, this all should happen in the tabBarController's first viewController. Each button in the grid on the first view, when pressed, will transition to the second view that has a textBox filled with information. Because I want to design my own UI out of images, I'm not using a standard drilldown navigationController.

    I tried following the code used in the video tutorial by Nick Meyers, to flip from the first view to the second, but I can't seem to wrap my head around how I would do that with the tabBar Controller's ViewController.

    So my question to all of you experts out there: How can I setup my tabBar application to allow the first button view to transition flip to a completely new view? And from the new view, back to the first\original view. All of this will need to happen in the first tabBar button's viewController.

    Thanks for any help,
  2. belsokar macrumors member

    Jul 21, 2005
    Sorry, this is not a solution to you problem...I just hope you get a response to this. I am trying to do something similar, only place a drill-down navigation controller within a particular view of a tab bar controller view.
  3. kainjow Moderator emeritus


    Jun 15, 2000
    Are you trying to flip the view controller's view, or the entire tab view? If the latter, you may be interested in hidesBottomBarWhenPushed.
  4. hyarlagadda macrumors newbie

    Oct 6, 2008
    Sorry, this is not solution but I have the same problem. I am using multiple NIB files in a TabBarController. And my first tab should load a NavigationController NIB file and display its view.
  5. sommeralex macrumors newbie

    Jul 27, 2008
    i also have problems with the TabBarController / NavbarController. Lets work together. Here is my sample code..
  6. belsokar macrumors member

    Jul 21, 2005
    What you need to do is something along the following lines:

    - setup your UIViewController classes and nibs.
    - setup your UINavigationController object(s), and initialize them with your UIViewControllers
    - setup a UITabBarController object and add the NavigationControllers to the viewControllers object of the UITabBarController.

    It should look something like this:

    UINavigationController *aNVC = [[UINavigationController alloc] initWithRootViewController: self.firstView];
    self.firstViewNavBarController = aNVC;
    [aNVC release];
    firstViewNavBarController.navigationBarHidden = YES;  //if you don't need it
    //Setup Nav Bar for Setup View
    UINavigationController *aNVC2 = [[UINavigationController alloc] initWithRootViewController: self.secondView];
    self.secondViewNavBarController = aNVC2;
    [aNVC2 release];
    tabBarController.viewControllers = [NSArray arrayWithObjects: self.firstViewNavBarController, self.secondViewNavBarController,nil];

Share This Page