将UINavigationController添加到现有的UINavigationController

时间:2013-07-31 04:17:56

标签: ios uinavigationcontroller presentmodalviewcontroller

简单的问题...我的应用程序从带有UIViewController的UINavigationController开始(当然),但是当按下按钮时,我想要呈现另一个UINavigationController。

我会这样做:

[self.navigationController presentViewController:AnotherNavigationController animated:YES completion:nil];

或:

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

两种方式都有效...但我不确定哪一种方法是正确的......而且,一旦导航控制器出现,我似乎无法看到BarButtonItem出现

PS。 navigationcontroller有一个tabbarcontroller,里面有两个标签视图

先谢谢!

2 个答案:

答案 0 :(得分:0)

试试这个:

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

请改用push segue。

答案 1 :(得分:0)

尝试此代码:登录成功后

UIStoryboard  *Story_TabController = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]
 UIViewController *class1 = [Story_TabController instantiateViewControllerWithIdentifier:@"Feed_ViewController"];

   UIViewController *class = [Story_TabController instantiateViewControllerWithIdentifier:@"FindFriends_ViewController"];


   UINavigationController *nav_profile=[[UINavigationController alloc]initWithRootViewController:class1];
   UINavigationController *nav_post=[[UINavigationController alloc]initWithRootViewController:class2];

    Tab_controller.viewControllers=[NSArray arrayWithObjects:nav_profile,nav_post, nil];

    Tab_controller.selectedIndex=0;
    [self.navigationController pushViewController:Tab_controller animated:YES];