0
votes

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.

enter image description here

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

1

1 Answers

1
votes

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.