我是我的应用程序的故事板。该应用程序的结构是一个没有导航栏或标签栏的登录屏幕,该标签栏通向应用程序,显示所有屏幕上的导航栏和标签栏。因此导航控制器通向标签栏控制器。
登录成功后,我尝试了以下操作:
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];
显示标签栏确实显示,但导航栏不显示。请有人帮我这个吗?或者请提出另一种方法来实现这一点。
提前致谢
答案 0 :(得分:0)
建议。你应该这样做:
self.navigationControllerOne.viewControllers = [NSArray arrayWithObject:diaryViewController];
self.navigationControllerTwo.viewControllers = [NSArray arrayWithObject:whatsNearViewController];
...
tabBarController.viewControllers=[NSArray arrayWithObjects:self.navigationControllerOne ,self.navigationControllerTwo, ... , nil];
然后高兴地推/解