Talha Ch Talha Ch - 2 months ago 4
Objective-C Question

How to start the TabBarController after a ViewController

I've a loginViewController and on successful login I want to start the app by showing the home screen which has a parent tab bar.enter image description here

The current process I'm using is:

UITabBarController *arvc = [self.storyboard instantiateViewControllerWithIdentifier:@"homeVC"];

[self presentViewController:arvc animated:YES completion:nil];

But it dosen't load the tab bar below the screen. So How to achieve it.


In your storyboard, From your loginviewController ctrl+drag to your UITabbarController and select show from popup. It will create new show segue from your login view controller to tabbarcontroller. then select that segue by clicking on it and from attribute inspector set it identifier like pushToTabbarController or whatever identifier you want to keep.

Now when you successfully login and when want to go to tabbbarviewcontroller then you just need to call,

   [self performSegueWithIdentifier:@"pushToTabbarController" sender:nil];  //identifier that you have set in Interface builder