Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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

    }
share|improve this question
    
please post some codes that you are currently using. –  verbumdei May 22 '13 at 0:40
    
@verbumdei I added –  Abílio Marcos May 22 '13 at 1:37
    
could you also post the void function that you actually want to call? –  verbumdei May 22 '13 at 1:38
    
I want to call a void function without parameters @verbumdei –  Abílio Marcos May 22 '13 at 1:50
    
then how about just calling that void function within the didFinishPickingMediaWithInfo function? –  verbumdei May 22 '13 at 1:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.