我想要一个新的视图控制器作为弹出窗口(其中有一些父视图控制器场景)。所以我决定添加childViewController (它有50px的透明边框)。现在,当我添加childViewController时,我没有得到navigationBar。这就是我添加全尺寸childViewController的方法。
ShowPostTVC *postvcObj = [self.storyboard instantiateViewControllerWithIdentifier:@"ShowPostTVC"];
UINavigationController *childNavController = [[UINavigationController alloc] initWithRootViewController:postvcObj];
[self.navigationController addChildViewController:childNavController];
[self.navigationController.view addSubview:postvcObj.view];
[postvcObj didMoveToParentViewController:self];如何在childViewController上获得真正的导航栏。
发布于 2014-11-06 22:33:09
显示新动画的正确方式是通过UINavigationController的pushViewController: ViewController。然后新的ViewController有一个NavigationBar:
ShowPostTVC *postvcObj = [self.storyboard instantiateViewControllerWithIdentifier:@"ShowPostTVC"];
[self.navigationController pushViewController:postvcObj animated:true]; 发布于 2014-11-06 22:33:22
不需要实例化新的UINavigationController,只需使用以下代码:
ShowPostTVC *postvcObj = [self.storyboard instantiateViewControllerWithIdentifier:@"ShowPostTVC"];
[self.navigationController pushViewController:postvcObj];https://stackoverflow.com/questions/26781902
复制相似问题