Here is my problem (See illustration bellow):
I have a main screen (MainViewController
) from which i present a form modal (ModalController
) embedded in a Navigation controller.
After completing the form I want to present the result to the user and dismiss the modal.
The result is shown with a ItemViewController
and it should be pushed on the main stack, i.e. in a navigation controller and if the user presses back, he returns to the main screen.
My problem is how to dismiss the modal and push the new view controller at the same time?
What I tried:
dismiss the modal and push the new view controller in the completion block using
self.parentViewController.navigationController pushViewController:itemViewController
but only the modal is dismissed.push the view controller the same way then dismiss, also without effect.
unwind the modal to the main screen and from the
unwindSegue
method, instantiate and push the new view controller. Unfortunately, the code below has the same effect..
- (IBAction)unwindSegue:(UIStoryboardSegue *)segue {
ItemViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ItemViewController"];
[self.navigationController pushViewController:viewController animated:YES];
}
Might be important In the storyboard, ItemViewController is embedded in a NavigationController since it is defined as on the picture below: