我正在使用基于导航的应用程序.我将 First ViewController 推送到 Second ViewController 并从 Second ViewController 推送到 Third ViewController.现在我想从第三个 ViewController 弹出到第一个 ViewController.我正在使用下面的代码执行此任务,但我的应用程序崩溃了.
I am using navigation based application. I push First ViewController to Second ViewController and from Second ViewController to Third ViewController. Now I want to pop from Third ViewController to First ViewController.I am performing this task using the below code but my application crashed.
请任何人给我一些适当的指导.我不能使用 pop 到 rootViewController,因为它是不同的 viewController.提前谢谢...
Please any body give me some proper guidelines. I can't use pop to rootViewController because it's different viewController. Thanks in advance...
在第三个 ViewControler 我写了这个:
FirstViewCtr *x=[[FirstViewCtr alloc] initWithNibName:@"FirstViewCtr" bundle:nil];
[self.navigationController popToViewController:x animated:NO];
通过编写第一行,您可以获得所有视图控制器的索引,从第二行您将到达目的地.
By Writing the First Line you get the Indexes of all View Controllers and from second Line You will reach up to your Destination.
NSArray *array = [self.navigationController viewControllers];
[self.navigationController popToViewController:[array objectAtIndex:2] animated:YES];
这篇关于我可以弹出到特定的 ViewController 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!