我已经使用Storyboard启动了一个iOS应用程序。在我的应用中,mainStoryBoard从导航控制器开始。从导航的视图控制器,我通过编程将控制器推送到第二个视图控制器([self performSegueWithIdentifier:@"currencyClick" sender:self])
。在第二个视图控制器上,我有一个按钮。在按钮上单击,我想回到导航的viewcontroller,[self.navigationController popViewControllerAnimated:YES]
但是这里self.navigationController popViewControllerAnimated:YES
不起作用。在我的项目中,我没有Shows navigation Bar
使用Navigationcontroller。
NavigationController-(root viewcontroller)-> viewController-(使用[self performSegueWithIdentifier:@“ currencyClick” sender:self];推送segue))-> CurrencyViewcontroller
在currencyviewController中,我有一个按钮。在单击按钮时,我要实现导航后退按钮单击事件。我如何以编程方式实现“后退”按钮,[self.navigationController popViewControllerAnimated:YES]
在这种情况下不起作用。
请帮助我解决这个问题。
在您的第一个视图控制器中调用secondcontroller,请使用:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"mainStoryBoard" bundle: nil];
SecondViewController *rvc = (SecondViewController *)[storyboard instantiateViewControllerWithIdentifier:@"SecondViewControllerNameInYourStoryBoard"];
[self.navigationController pushViewController:rvc animated:YES ];
而不是self performSegue ...然后在第二个控制器中弹出应该起作用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句