loading Tabbar controller from view controller

I am working with a project in which I have to have a login page and after successful login we should have a tabbar view (I am using tab bar controller) when I try to load the tab bar controller using the following code.Nothing works out.

LoginSuccess *viewController = [[LoginSuccess alloc] initWithNibName:@"LoginSuccess" bundle:nil];
        [self.view addSubview:viewController.tabBarController.view];
        [viewController release];

please help me.

Answers


I do same work but me call appdelegate after success of login response [mAppDelegate loadTabbar];//call function in delegate file to load tabbar view whom code is follow

#pragma mark -
#pragma mark Load TabBar
-(void)loadTabBar
{
    self.tabBarController = [[UITabBarController alloc] init];
    tabBarController.delegate = self;

    MyAlarmVC *myAlarmVC = [[MyAlarmVC alloc] initWithNibName:@"MyAlarmVC" bundle:nil];
    UINavigationController *myAlarmNVC = [[UINavigationController alloc] initWithRootViewController:myAlarmVC];
    myAlarmNVC.navigationBar.tintColor = [UIColor whiteColor];
    [myAlarmVC release];


    MyVideosVC *myVideoVC = [[MyVideosVC alloc] initWithNibName:@"MyVideosVC" bundle:nil];
    UINavigationController *myVideoNVC = [[UINavigationController alloc] initWithRootViewController:myVideoVC];
    myVideoNVC.navigationBar.tintColor = [UIColor whiteColor];
    [myVideoVC release];


    MyFriendsVC *myFriendVC = [[MyFriendsVC alloc] initWithNibName:@"MyFriendsVC" bundle:nil];
    UINavigationController *myFriendNVC = [[UINavigationController alloc] initWithRootViewController:myFriendVC];
    myFriendNVC.navigationBar.tintColor = [UIColor whiteColor];
    [myFriendVC release];


    MyMessageVC *myMessageVC = [[MyMessageVC alloc] initWithNibName:@"MyMessageVC" bundle:nil];
    UINavigationController *myMessageNVC = [[UINavigationController alloc] initWithRootViewController:myMessageVC];
    myMessageNVC.navigationBar.tintColor = [UIColor whiteColor];
    [myMessageVC release];

    MyProfileVC *myProfileVC = [[MyProfileVC alloc] initWithNibName:@"MyProfileVC" bundle:nil];
    UINavigationController *myProfileNVC = [[UINavigationController alloc] initWithRootViewController:myProfileVC];
    myProfileNVC.navigationBar.tintColor = [UIColor whiteColor];
    [myProfileVC release];

    tabBarController.viewControllers = [NSArray arrayWithObjects:myAlarmNVC,myVideoNVC, myFriendNVC,myMessageNVC,myProfileNVC, nil];
    [myAlarmNVC release];
    [myVideoNVC release];
    [myProfileNVC release];
    [myFriendNVC release];
    [myMessageNVC release];
    [self.window addSubview:tabBarController.view ];
    //tabBarController.navigationController.navigationBarHidden = YES;
    [self.tabBarController release];

}

- (void)tabBarController:(UITabBarController *)tabBarController1 didSelectViewController:(UIViewController *)viewController{

    NSArray *vc= tabBarController1.viewControllers;

    for (int i = 0; i < [vc count]; i++) {

        UINavigationController *nc = [vc objectAtIndex:i];

        if (nc == tabBarController1.selectedViewController) {

            continue;
        }

[nc popToRootViewControllerAnimated:NO];
    }

}

if you got problem then just tell me the view names of your tabbar


Need Your Help

Must hide one line / password in my Google Sheets script

json google-apps-script

I've created a Google Sheet that accepts input from the user, then based on that information, goes to an external website and automatically populates the spreadsheet.

What is the fastest way to check if files are identical?

language-agnostic file comparison

If you have 1,000,0000 source files, you suspect they are all the same, and you want to compare them what is the current fasted method to compare those files? Assume they are Java files and platform