View a programmatic view

enter image description here

Hi this is my storyboard, I want to go from the first view controller to LoggedinViewController.

I usually use

[self performSegueWithIdentifier:@"s1" sender:self];

      

but if i add a tab bar controller this line doesn't work, how can i fix it?

+3


source to share


2 answers


You can use the following if you have embedded in the navigation controller.

UIStoryboard *myStoryBoard =[UIStoryboard storyboardWithName:@"Story_Board_Name" bundle:nil];
 UITabBarController *tabBarController = [myStoryBoard instantiateViewControllerWithIdentifier:@"TABid"];
self.tabBarController.selectedIndex = 0;
 [self.navigationController pushViewController:self.tabBarController animated:YES];

      



Or try this

UIStoryboard *myStoryBoard =[UIStoryboard storyboardWithName:@"Story_Board_Name" bundle:nil];
 UITabBarController *tabBarController = [myStoryBoard instantiateViewControllerWithIdentifier:@"TABid"];
self.tabBarController.selectedIndex = 0;
[self performSegueWithIdentifier:@"s1" sender:self];

      

+3


source


Give your tabbarcontroller an id from storyboard, do something like this

 UIStoryboard *myStoryBoard =[UIStoryboard storyboardWithName:@"Your_Story_Board_Name" bundle:nil];
 TabViewController *tabBarController = [myStoryBoard instantiateViewControllerWithIdentifier:@"TAB_Identifier"];
 [self presentViewController:tabBarController animated:YES completion:nil];  

      



Hope it helps

0


source







All Articles