我已经启动了一个带有 Storyboard的 iOS 应用程序。在我的应用程序中,mainStoryBoard 从导航 Controller 开始。从导航的 View Controller ,我将 Controller 传递给第二个 View Controller ,通过编程 ([self performSegueWithIdentifier:@"currencyClick"sender:self])
进行推送。在第二个 View Controller 上我有一个按钮。单击按钮后,我想返回导航的 View Controller ,如 [self.navigationController popViewControllerAnimated:YES]
但此处 self.navigationController popViewControllerAnimated:YES
不起作用。在我的项目中,我取消选中 Navigationcontroller 中的 Shows navigation Bar
。
NavigationController-(root viewcontroller)-> viewController --(push segue with [self performSegueWithIdentifier:@"currencyClick"sender:self];)-->CurrencyViewcontroller
在 currencyviewController 中我有一个按钮。单击按钮我想实现导航后退按钮单击事件。我如何以编程方式实现后退按钮,[self.navigationController popViewControllerAnimated:YES]
在这种情况下不起作用。
请帮我解决这个问题.. 提前致谢
最佳答案
要在第一个 View Controller 中调用第二个 Controller ,请使用:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"mainStoryBoard" bundle: nil];
SecondViewController *rvc = (SecondViewController *)[storyboard instantiateViewControllerWithIdentifier:@"SecondViewControllerNameInYourStoryBoard"];
[self.navigationController pushViewController:rvc animated:YES ];
而不是 self 执行...然后在你的第二个 Controller 中弹出应该可以工作。
关于iphone - xcode 4.5 中的 iOS Storyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19402626/