[英]iOS Storyboard in xcode 4.5
I have started an iOS app with storyboard. 我已经开始使用故事板的iOS应用程序。 In my app, mainStoryBoard starts with navigation controller.
在我的应用程序中,mainStoryBoard以导航控制器开始。 From navigation's view controller, I pass the controller to a second viewcontroller with a push segue by programatically
([self performSegueWithIdentifier:@"currencyClick" sender:self])
. 从导航的视图控制器,我通过编程方式将控制器传递给第二个具有push segue的viewcontroller
([self performSegueWithIdentifier:@"currencyClick" sender:self])
。 On the second view controller I have a button. 在第二个视图控制器上,我有一个按钮。 On button click I want to go back to navigation's viewcontroller like
[self.navigationController popViewControllerAnimated:YES]
but here self.navigationController popViewControllerAnimated:YES
is not working . 点击按钮我想回到导航的viewcontroller,如
[self.navigationController popViewControllerAnimated:YES]
但这里self.navigationController popViewControllerAnimated:YES
无法正常工作。 In my project I unticked Shows navigation Bar
in Navigationcontroller. 在我的项目中,我取消了在Navigationcontroller中
Shows navigation Bar
。
NavigationController-(root viewcontroller)-> viewController --(push segue with [self performSegueWithIdentifier:@"currencyClick" sender:self];)-->CurrencyViewcontroller NavigationController-(root viewcontroller) - > viewController - (用[self performSegueWithIdentifier:@“currencyClick”发送者:self]推送segue;) - > CurrencyViewcontroller
In currencyviewController I have a button. 在currencyviewController我有一个按钮。 On button click I want to implement navigation back button click event.
单击按钮我想实现导航后退按钮单击事件。 How do I implement a BACK Button programmatically,
[self.navigationController popViewControllerAnimated:YES]
is not working in this case. 如何以编程方式实现BACK按钮,
[self.navigationController popViewControllerAnimated:YES]
在这种情况下不起作用。
Please help me to solve this problem.. Thanks in advance 请帮我解决这个问题..提前谢谢
to call secondcontroller in your first view controller use: 在第一个视图控制器中调用secondcontroller使用:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"mainStoryBoard" bundle: nil];
SecondViewController *rvc = (SecondViewController *)[storyboard instantiateViewControllerWithIdentifier:@"SecondViewControllerNameInYourStoryBoard"];
[self.navigationController pushViewController:rvc animated:YES ];
instead of self performSegue... Then in your second controller pop should work. 而不是自我执行Segue ...然后在你的第二个控制器弹出应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.