I want to add a confirmation view after the user takes a photo or selects a saved photo. The confirmation view will just show the selected image, with a cancel and upload button in a toolbar.
My UIImagePickerController is presented modally from one of my view controllers, which is controlled by a navigation controller, which is in turn controlled by a tab bar controller.
How do I present my confirmation view modally so that it takes up the full screen (like the image picker view) when the user selects a photo? Ideally, I want something like this:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
UIViewController *modal = [[UIViewController alloc] init];
modal.view = confirmationView;
[self presentModalViewController:modal animated:YES];
[modal release];
}
However, that crashes the app. Should I be presenting the the confirmation view modally from the PICKER? If so, how do I make sure that when the confirmation view is dismissed, the picker will not be displayed either?
EDIT:
Fixed the bug in the code I posted. That's what happens when I try to type from memory instead of copy+paste :( Anyways, the suggestions so far don't help.
If I present the modal controller THEN dismiss the picker, nothing happens, presumably since both controllers are subsequently dismissed.
If I dismiss the picker THEN present the modal controller, I get an exception about modal transitions:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to begin a modal transition from <UINavigationController: 0x6b33940> to <UIViewController: 0x6b62b00> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed'