I'm trying to understand how to setup a NavigationController. I don't understand why this code works with both a pushViewController AND presentModalViewController. I thought it had to be one or the other.
For context, this is a UIViewController that creates a UIImagePickerController. There are two view controllers after, the first (EditPictureViewController) edits the image itself and the second edits the properties. Believe I should use presentModalViewController.
...also is there a way to not dismiss the Modal View Controller so I can have a retake picture button on the EditPictureViewController?
Thanks.
- (void)viewDidLoad {
[super viewDidLoad];
self.navController = [[UINavigationController alloc] init]; }
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissModalViewControllerAnimated:NO];
EditPictureViewController *viewController = [[EditPictureViewController alloc] initWithImage:image];
[viewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self.navController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self.navController pushViewController:viewController animated:NO];
[self presentModalViewController:self.navController animated:YES]; }
This pushes the EditPictureViewController onto the NavigationController's view stack.
[self.navController pushViewController:viewController animated:NO];
Then you present the NavigationController here:
[self presentModalViewController:self.navController animated:YES];
I mean, all you're doing is presenting a modal view from a view controller and that modal happens to be a NavigationController.