OGeek|极客世界-中国程序员成长平台

标题: ios - 从侧边菜单推送 NavigationController 中的 ViewController [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 16:16
标题: ios - 从侧边菜单推送 NavigationController 中的 ViewController

我正在使用 UINavigationController,其中有一个侧边菜单。问题是,当我想从侧 View 将 UIViewController 推送到 NavigationController 中时,它不起作用。为此,请使用该代码:

  [self.slidingViewController resetTopView];    

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

如你所见,我首先关闭了侧边菜单,然后调用 NavigationController 来推送一个新的 ViewController。使用该代码,唯一发生的事情是菜单已关闭,但 NavigationController 不会推送任何 ViewController。我该怎么办?



Best Answer-推荐答案


popToViewController 意味着返回到已经成为导航 Controller 堆栈一部分的那个。如果你想显示一个新的,使用 pushViewController

关于ios - 从侧边菜单推送 NavigationController 中的 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19879659/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4