ios - 无法从 ios 中的当前 View Controller 调用导航 Controller

标签 ios objective-c uiviewcontroller uinavigationcontroller

在我的应用程序中,我使用当前的UIModalViewController启动一个屏幕,并且在该屏幕上我有一个UIButton,如果我们单击该UIButton警报将出现,然后在警报 View 上选择是,现在我们必须使用 pushviewcontroller 调用另一个 View 。但是如果我们使用下面的代码,屏幕不会出现,任何人都可以帮助我。

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

最佳答案

尝试使用一个根导航 Controller ,然后按如下方式呈现您的 Controller :

FirstViewController *firstView=[[FirstViewController alloc]init];
UINavigationController *navigationController = [[UINavigationController alloc]                                               initWithRootViewController:firstView];
[self presentViewController:navigationController animated:YES completion:nil];

然后推送另一个 View 如下:

SecondViewController *secondView=[[SecondViewController alloc]init];     
[self.navigationController pushViewController:secondView animated:YES];

它将首先使用当前模态 viewController 工作,然后使用推送导航 viewControllers 到堆栈上。

关于ios - 无法从 ios 中的当前 View Controller 调用导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30317998/

相关文章:

ios - Documents 文件夹路径中的十六进制部分是什么?

ios - 在重用之前释放并在退出时解除分配的对象的潜在泄漏

iphone - 关于使用 NSURLConnection 下载文件并显示进度的问题

ios - 使用 UISegmentedControl 切换 viewController

ios - 如何从下到上呈现部分高度模态视图 Controller

ios - 关闭 ModalViewController 时返回除 ParentViewController 之外的 ViewController

ios - Restkit 集成到 iOS 项目中

iphone - 识别推送通知消息

ios - 从另一个 Swift 文件向 UIViewController 添加手势

ios - 在 MMDrawerController 上传递数据