Ios 导航控制器到选项卡栏控制器

Ios 导航控制器到选项卡栏控制器,ios,uinavigationcontroller,uitabbarcontroller,uinavigationbar,uitabbar,Ios,Uinavigationcontroller,Uitabbarcontroller,Uinavigationbar,Uitabbar,我正在编写我的应用程序的故事板。该应用程序的结构是一个没有导航栏或选项卡栏的登录屏幕,导航栏或选项卡栏在所有屏幕上显示导航栏和选项卡栏。因此,导航控制器将引入选项卡栏控制器 登录成功后,我尝试了以下操作: UITabBarController *tabBarController=[[UITabBarController alloc]init]; DiaryViewController *diaryViewController = (DiaryViewController *)[storyboa

我正在编写我的应用程序的故事板。该应用程序的结构是一个没有导航栏或选项卡栏的登录屏幕,导航栏或选项卡栏在所有屏幕上显示导航栏和选项卡栏。因此,导航控制器将引入选项卡栏控制器

登录成功后,我尝试了以下操作:

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];
它确实会显示选项卡栏,但导航栏不会显示。有人能帮我吗?或者请建议另一种方法来实现这一点


提前谢谢你的建议。你应该反过来做:

self.navigationControllerOne.viewControllers = [NSArray arrayWithObject:diaryViewController];
self.navigationControllerTwo.viewControllers = [NSArray arrayWithObject:whatsNearViewController];
...
tabBarController.viewControllers=[NSArray arrayWithObjects:self.navigationControllerOne ,self.navigationControllerTwo, ... , nil];
然后高兴地推/放