Vikings
Vikings

Reputation: 2527

Image Picker Controller

I am using the UIImagePickerController to take a picture, that works great, but do not want to use the stand image editor, instead I want to use my own custom image editor. I want to transition to that after I take the picture. I am using the method below to push a view controller after the image picker dismisses.

However, I want to push this before the image picker dismiss to avoid an awkward transition. Any ideas?

- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info;

Upvotes: 0

Views: 338

Answers (1)

matt
matt

Reputation: 536027

The image picker is already in a navigation interface, so you can push anything you like onto the image picker as a secondary (editing) interface:

- (void)imagePickerController:(UIImagePickerController *)picker
        didFinishPickingMediaWithInfo:(NSDictionary *)info {
    UIImage* im = info[UIImagePickerControllerOriginalImage];
    if (!im)
        return;
    SecondViewController* svc =
        [[SecondViewController alloc] initWithNibName:nil bundle:nil image:im];
    [picker pushViewController:svc animated:YES];
}

You will, however, have to interfere to prevent the image picker from navigating to its own secondary interface. The easy way to do that is to set picker.showsCameraControls = NO and substitute your own controls.

Also, I might be wrong about this, but since you are the navigation controller delegate I think you can just veto an attempt by the image picker to navigate to its own secondary interface. (EDIT: No, I guess not, sorry. The delegate gets a will and a did but not a should message.)

Upvotes: 1

Related Questions