简体   繁体   中英

Move from view controller to tab bar controller

When you create a tab bar controller via the interface and not programatically you dont have a tab bar controller class. How do you move from a view controller to this tab bar controller in a case such as this?

At first make the tabbarcontroller then make uiview controller ...such as...

NSMutableArray *listOfViewControllers = [[NSMutableArray alloc] init];

        tab1view = [[tab1viewcontroller alloc] initWithNibName:@"tab1viewcontroller" bundle:nil];
        [listOfViewControllers tab1view];
        [tab1view release];

        tab2view = [[tab2viewcontroller alloc] initWithNibName:@"tab2viewcontroller" bundle:nil];
        [listOfViewControllers tab2view];
        [tab2view release];

        [self.tabBarController setViewControllers:listOfViewControllers animated:YES];

i think it will help you.

You could try and create the tab bar controller first. Then show the full-screen splash screen modally (eg without animation, so that user won't notice the tab bar controller) and off that splash screen you present location selector. Once the user is done with it you dismiss both modal controllers revealing tab controller.

If you need to set up view controllers in your tab bar controller based on the information you're getting from location selector you can do it eg via a delegate, that is:

  1. Implement delegate for splash screen and location selector
  2. Instantiate tab bar controller
  3. Show the splash screen, setting current vc of tab bar controller a delegate of the splash screen
  4. Show location selector, setting its delegate to the same view controller (you'll have the handle in splash screen)
  5. Once user dismisses location selector you inform the delegate about it and it's able to collect needed data from the location selector.

I hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM