I have a weird timing issue, it seems. I open a uiimagepicker as a modal view. When the user picks an image or I want to take the image, save it to a variable, then open an email interface as a modalview.
My problem is that I am calling dismissModalViewController on the imagepicker, then calling presentmodalviewcontroller for my email interface, but the imagepicker isn't going away in time for the email view to be presented. Is there a way to 'wait' for that line of code to complete?
(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
if( [[info objectForKey:UIImagePickerControllerMediaType] isEqualToString:@"public.image"] ){
[self dismissModalViewControllerAnimated:YES];
imageFromCamera = [[UIImageView alloc] initWithImage:[info objectForKey:UIImagePickerControllerOriginalImage]];
MFMailComposeViewController *mailView = [[MFMailComposeViewController alloc] init];
mailView.mailComposeDelegate = self;
[self presentModalViewController:mailView animated:YES];
[mailView release];
}
}
I'm pretty sure I've designed something wrong, but help me out if you can.