如果我用
NGViewController *ngView = [[NGViewController alloc]initWithNibName:Nil bundle:Nil];
[self presentViewController:ngView animated:NO completion:nil];
上面的代码 Controller 将转到 NGViewController 页面。
但是如果我使用这个导航 Controller
NGViewController *ngView = [[NGViewController alloc]initWithNibName:Nil bundle:Nil];
[self.navigationController pushViewController:ngView animated:YES];
Controller 将在同一页面中。
任何人都可以告诉这是什么问题。
最佳答案
你应该使用这段代码
NGViewController *ngView = [[NGViewController alloc]initWithNibName:Nil bundle:Nil];
[self presentViewController:ngView animated:NO completion:nil];
写完这一行之后,你想使用推送 View Controller 进入不同的页面
UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:ngView];
[self.navigationController pushViewController:navigationController animated:YES];
我希望你能通过这段代码解决这个问题祝你好运
关于ios - [self.navigationController pushViewController :ngView animated:YES]; not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16710675/