Gladmir
Gladmir

Reputation: 185

dismissModalViewControllerAnimated: does not dismiss the modal view

After capturing the image, callback occurs but something is wrong cause it's not dismissing the Camera View. My code is pretty straight forward, my only doubt is that I am using a tab bar controller and pushing the imagePicker within one of the tabs, just a thought.

- (IBAction)imageButtonPressed:(id)sender {
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.sourceType =  UIImagePickerControllerSourceTypeCamera;
    imagePicker.delegate = self;
    imagePicker.allowsEditing = YES;
    [self presentModalViewController:imagePicker animated:YES];
}



- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [self dismissModalViewControllerAnimated:YES];
    self.portaitImage.image = [info objectForKey:UIImagePickerControllerOriginalImage];
}

Upvotes: 0

Views: 1784

Answers (1)

beryllium
beryllium

Reputation: 29767

You need to dismiss UIImagePickerController, not self:

[picker dismissModalViewControllerAnimated:YES];

Upvotes: 2

Related Questions