简体   繁体   English

从侧面菜单中在NavigationController中推送ViewController

[英]Push ViewController in NavigationController from side menu

I'm using a UINavigationController and I have a side menu in it. 我正在使用UINavigationController,并且其中有一个侧面菜单。 The problem is that when I want to push a UIViewController in the NavigationController from the side view it doesn't work. 问题是,当我想从侧面视图在NavigationController中推送UIViewController时,它不起作用。 To do it, is use that code: 为此,请使用以下代码:

  [self.slidingViewController resetTopView];    

CDRecentChats* recentchats = [[CDRecentChats alloc]init];
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"conversation"];
[recentchats.navigationController pushViewController:controller animated:YES];

As you can see, I first close de side menu and then call the NavigationController to push a new ViewController. 如您所见,我首先关闭右侧菜单,然后调用NavigationController推送新的ViewController。 Using that code, the only thing that happens is that the menu is closed, but the NavigationController doesnnt push any ViewController. 使用该代码,唯一发生的事情是菜单被关闭,但是NavigationController不会推送任何ViewController。 what can I do? 我能做什么?

popToViewController means to go back to one that has already been made part of the navigation controller's stack. popToViewController意味着返回到已经成为导航控制器堆栈一部分的一个。 If you're trying to show a new one, use pushViewController . 如果您要显示一个新的,请使用pushViewController

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从ViewController选择(推送)到NavigationController中嵌入的另一个ViewController? - How to segue (push) from ViewController to another ViewController embedded in NavigationController? 当按下viewcontroller时,navigationController为nil - navigationController is nil,when push the viewcontroller 如何从一个navigationcontroller推送到多个viewcontroller? - How do I push from one navigationcontroller to multiple viewcontroller? 在AppDelegate App崩溃时将3个以上ViewController推入NavigationController中 - Push more than 3 ViewController in NavigationController from AppDelegate App crash 推送ViewController时清除navigationController堆栈 - Clear navigationController stack when push ViewController 无法推送 viewController,因为 navigationController 为零 - Can't push viewController because navigationController is nil 如何将侧边栏菜单推送到iPhone中的另一个viewController - how to push side bar menu to another viewController in iphone 从侧面菜单中选择主ViewController - Segue main ViewController from side menu 从堆栈的ViewController中的NavigationController的prepareForSegue - prepareForSegue for NavigationController in ViewController from stack 从侧面菜单推ViewController不起作用 - Pushing ViewController from side menu not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM