0

I am making an application but I'm still a beginner and I'm trying to get used to the RootViewController and how it should be set.

At the beginning my application launches, I want there to be a View which is not in my tabBarController (which is set to be my rootViewController).

What I am trying to ask is, Can I have another view which is outside my UITabBarController launch first without it being in the tabBarController's items list?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.

    FacebookFeedViewController *facebookClass = [[FacebookFeedViewController alloc] initWithNibName:@"FacebookFeedViewController" bundle:nil];

    TwitterFeedViewController *twitterClass = [[TwitterFeedViewController alloc] initWithNibName:@"TwitterFeedViewController" bundle:nil];
    LinkedInFeedViewController *linkClass = [[LinkedInFeedViewController alloc] initWithNibName:@"LinkedInFeedViewController" bundle:nil];
    FTLFullFeedViewController *masterClass = [[FTLFullFeedViewController alloc] initWithNibName:@"FTLFullFeedViewController" bundle:nil];

    ///   tab button title

    facebookClass.title = @"Facebook";
    twitterClass.title = @"Twitter";
    linkClass.title=@"LinkedIn";
    masterClass.title=@"FTL";

    // tab button Images
    facebookClass.tabBarItem.image = [UIImage imageNamed:@"facebook_32"];
    twitterClass.tabBarItem.image = [UIImage imageNamed:@"twitter_32"];

    WelcomeViewController *welcomeClass= [[WelcomeViewController alloc] initWithNibName:@"WelcomeViewController" bundle:nil];

    navController = [[ UINavigationController alloc] initWithRootViewController:welcomeClass];

    UINavigationController *navController2 = [[UINavigationController alloc] initWithRootViewController:facebookClass];
    UINavigationController *navController3 = [[UINavigationController alloc] initWithRootViewController:twitterClass];
    UINavigationController *navController4 = [[UINavigationController alloc] initWithRootViewController:linkClass];
    UINavigationController *navController5 = [[UINavigationController alloc] initWithRootViewController:masterClass];

    self.tabBarController = [[UITabBarController alloc] init];
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:navController,navController5,navController2,navController3,navController4,nil];
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];

    return YES;
}
CRDave
  • 9,279
  • 5
  • 41
  • 59

2 Answers2

0

yes! ofcourse you do.

[self.view addsubview:yourTabbar.view];

Hope this will help you.

0

I know you already selected an answer but all that's doing is pushing a UITabBar view on top of an existing view, not creating a new UITabBarController view. Based on our brief conversation (latest XCode, no StoryBoards, using XIBs) you're going to want to create a xib as a UITabBarController then push it into view...

View *view = [[View alloc] initWithNibName:@"myUITabBarXIB" bundle:nil];
view.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController: view animated:YES];

This will present your XIB file but not on top of the existing view controller when the desired action takes place.

Dan
  • 5,153
  • 4
  • 31
  • 42
  • Thank you very much for this answer. It makes much more sense and it was just what I needed. Hope I can help you out with something in the future. Thanks again. – Vlatko Svegjan Jun 24 '13 at 14:38