简体   繁体   中英

iOS Storyboard in xcode 4.5

I have started an iOS app with storyboard. In my app, mainStoryBoard starts with navigation controller. From navigation's view controller, I pass the controller to a second viewcontroller with a push segue by programatically ([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 . In my project I unticked Shows navigation Bar in Navigationcontroller.

NavigationController-(root viewcontroller)-> viewController --(push segue with [self performSegueWithIdentifier:@"currencyClick" sender:self];)-->CurrencyViewcontroller

In currencyviewController I have a button. 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.

在此输入图像描述

Please help me to solve this problem.. Thanks in advance

to call secondcontroller in your first view controller use:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM