How to determine preview status of UIImagePickerController?

I use the standard image picker to take some photo of the camera.

When the user takes a photo, he displays the Preview screen with 2 Repeat and Use buttons.

How do I detect that the Preview screen is active or the Retry button is pressed? Is it possible? Are useful properties or events? Something like when the image source is a library, the is - property allows you to edit, which displays a similar screen.

UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
+6
source share
2 answers

A little in fact, but maybe someone is still looking for an answer like me. If you want to continue using the built-in camera controls, you can check the ImagePickerController sub-items to determine if the view is displayed after recording.

 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; } } 

"PLTileContainerView" is a subtitle that contains an editing slider that allows you to view the video frame by frame, so if it is present, it means that your video has already been recorded.

0
source

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 have no way to detect it (other than subclassing UIImagePickerController , which may be prohibited or in another way that I don’t know about), but a second response is most likely detected:

 - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { [picker dismissModalViewControllerAnimated:YES]; } 
-2
source

All Articles