0
votes

I am storyboarding my app. The structure of the app is a login screen without a navigation bar or a tab bar which leads into the app showing navigation bar and tab bar on all screens. So a navigation controller leading into a tab bar controller.

I have tried the following when log in is successful:

UITabBarController *tabBarController=[[UITabBarController alloc]init];

DiaryViewController *diaryViewController = (DiaryViewController *)[storyboard instantiateViewControllerWithIdentifier:@"diary"];
WhosOutViewController *WOutViewController = (WhosOutViewController *)[storyboard instantiateViewControllerWithIdentifier:@"WhoOut"];
WhatsNearViewController *whatsNearViewController = (WhatsNearViewController *)[storyboard instantiateViewControllerWithIdentifier:@"WhatsNear"];
MoreViewController *moreViewController = (MoreViewController *)[storyboard instantiateViewControllerWithIdentifier:@"More"];
tabBarController.viewControllers=[NSArray arrayWithObjects:diaryViewController,whatsNearViewController, WOutViewController, moreViewController, nil];

[self.navigationController pushViewController:tabBarController animated:YES];

It does push with showing a tab bar but the navigation bar doesn't display. Can someone help me with this please? Or please suggest another way to implement this.

Thanks in advance

1

1 Answers

0
votes

Suggestion .You should do the other way round:

self.navigationControllerOne.viewControllers = [NSArray arrayWithObject:diaryViewController];
self.navigationControllerTwo.viewControllers = [NSArray arrayWithObject:whatsNearViewController];
...
tabBarController.viewControllers=[NSArray arrayWithObjects:self.navigationControllerOne ,self.navigationControllerTwo, ... , nil];

and then push/dismiss happily