Hello,
I am working on a project using storyboards. The initial scene is a UITableViewController embedded in a Navigation Controller. When a button is pressed on this scene, it segues to a UIViewController that is embedded in another Navigation Controller. Upon the ViewController loading, a UIAlertView appears with a cancel button. This button is handled by my view controller. When is it pressed it should segue back to the TableView controller.
The NSLog fires as expected letting me know that the cancel button has been pressed. Then the popViewControllerAnimated: does nothing. According to the documentation it should set the previous view controller as the current one (in this case the TableViewController). When I log the number of view controllers in the stack, the value is 1.
Is this because the TableViewController is being handled by a separate Navigation Controller?
And if so, what is the best way to unwind the segue? Or, am I completely botching something?
Could someone please help me understand my mistake(s)?
Thanks!
I am working on a project using storyboards. The initial scene is a UITableViewController embedded in a Navigation Controller. When a button is pressed on this scene, it segues to a UIViewController that is embedded in another Navigation Controller. Upon the ViewController loading, a UIAlertView appears with a cancel button. This button is handled by my view controller. When is it pressed it should segue back to the TableView controller.
Code:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0) {
NSLog(@"Canceled.");
[self.navigationController popViewControllerAnimated:YES];
NSLog(@"The number of view controllers: %i", [[self.navigationController viewControllers] count]);
}else{
}
}
The NSLog fires as expected letting me know that the cancel button has been pressed. Then the popViewControllerAnimated: does nothing. According to the documentation it should set the previous view controller as the current one (in this case the TableViewController). When I log the number of view controllers in the stack, the value is 1.
Is this because the TableViewController is being handled by a separate Navigation Controller?
And if so, what is the best way to unwind the segue? Or, am I completely botching something?
Could someone please help me understand my mistake(s)?
Thanks!
Last edited: