8

I use standart image picker to make some camera photo.

When user makes photo image picker shows him the Preview screen with 2 buttons "Retake" and "Use".

How to detect that Preview screen is active now or "Retake" button pressed? Is it possible ? Are the useful properties or events? Something like when image source is library the is property - allows editing, which shows similar screen .

UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
B.S.
  • 21,660
  • 14
  • 87
  • 109
  • Here's the answer .. http://stackoverflow.com/questions/17942444/uiimagepicker-cameraoverlayview-appears-on-retake-screen – Fattie Feb 19 '14 at 16:46

2 Answers2

0

A bit after the fact, but maybe someone is still seeking this answer like I was. If you want continue using the native camera controls, you can check the subviews of the ImagePickerController to determine if the post-record view is showing.

BOOL videoTaken = NO;

for (UIView *aView in self.imagePickerController.view.subviews[0].subviews[0].subviews[0].subviews)
{
    if ([aView isKindOfClass:NSClassFromString(@"PLTileContainerView")])
    {
        videoTaken = YES;
        break;
    }
}

The "PLTileContainerView" is the subview that contains the editing slider that lets you view your video frame by frame, so if it's present, that means your video has already recorded.

Adam
  • 147
  • 4
  • 11
-2

For use:

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{    
    [picker dismissModalViewControllerAnimated:NO];
    NSString *type = [info objectForKey:@"UIImagePickerControllerMediaType"];
    if ([type isEqualToString:@"public.movie"]) {

    } else {
        UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    }
}

For Cancel you don't have a way of detecting it (other than subclassing UIImagePickerController, which may be prohibited, or other way that I'm not aware), but for sure the second cancel is detectable :

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {    
    [picker dismissModalViewControllerAnimated:YES];
}
Dani Pralea
  • 4,545
  • 2
  • 31
  • 49
  • The second cancel is image picker cancel. Of course it is detectable – B.S. Jan 29 '13 at 11:56
  • 1
    Don't hate the player, hate the game. No need for sarcasm :) – Dani Pralea Jan 29 '13 at 11:56
  • 1
    Sorry, but i do not need the image picker event. I need to know if User had made a photo and picker is in the preview state. – B.S. Jan 29 '13 at 11:57
  • 1
    Exists a state when user made a photo but it is not picked. Preview state. Is it detectable? Because i can't find any solution – B.S. Jan 29 '13 at 11:58
  • There isn't one that I know of. Try checking if UIImagePickerController can be subclassed to be notified to its events. – Dani Pralea Jan 29 '13 at 12:01