Using the UIImagepickerController cameraoverlayview to take a photo?

I am using UIImagepickerController to take pictures from the camera. I use my own view over the camera view using the cameraoverlayview property ... I want to take a picture from the camera when the user clicks a button on my normal view ... I use the following code

 - (void)viewDidLoad {

imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.sourceType =  UIImagePickerControllerSourceTypeCamera;
    [self presentModalViewController:imagePickerController animated:YES];   
    imagePickerController.showsCameraControls=NO;

imagePickerController.cameraOverlayView = self.customView;

}

- (IBAction) takePicture
{
    [imagePickerController takePicture];
}

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

    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];

    imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

[picker dismissModalViewControllerAnimated:YES];

}

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

but when I run this code, it gives me an error

ERROR: FigCreateCGImageFromJPEG returns -12905. The input (null) was 773625 bytes.

and I also get warnings for memory usage level 2 and then level 1

and the image in the image is not displayed. Can someone help me what can I do wrong? By the way, I am using iPhone 3G with iOS4.1 installed

+3
1

UIImagePickerControllerOriginalImage - ( NSString *), . , . , , , .

+1

Source: https://habr.com/ru/post/1774014/


All Articles