I can call the image picker to take photo with [picker takePicture];
But after that, I want to use the image that I took automatically, with code, not with: 1didFinishPickingMediaWithInfo:1
but a void function of the picker... Can I?
[picker takePicture];
picker.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto;
picker.cameraFlashMode = UIImagePickerControllerCameraFlashModeOn;
I would like to call the function above without real click on "USE" button
- (void)imagePickerController:(UIImagePickerController *)picker2 didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSLog(@"didFinishPickingMedia");
[picker2 dismissViewControllerAnimated:YES completion:NULL];
NSString *mediaType =
[info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage])
{
NSLog(@"ImageSave");
UIImage *image = [info
objectForKey:UIImagePickerControllerOriginalImage];
UIImageWriteToSavedPhotosAlbum(image,
self,
@selector(image:finishedSavingWithError:contextInfo:),
nil);
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"SAVED"
message:@"Image saved in your camera roll" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alertView show];
}
else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie])
{
NSString *moviePath = [[info objectForKey:
UIImagePickerControllerMediaURL] path];
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (moviePath)) {
UISaveVideoAtPathToSavedPhotosAlbum (
moviePath, nil, nil, nil);
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"SAVED"
message:@"Video saved in your camera roll" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alertView show];
}
}
}