Programmatically Take Picture Without User Interac

2019-05-05 07:14发布

How do I take Picture without User Interaction or without presenting ImagePickerController

  UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];

    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {
        [imagePickerController setSourceType:UIImagePickerControllerSourceTypeCamera];
    }

    // image picker needs a delegate,
    [imagePickerController setDelegate:self];

    // Place image picker on the screen
    [self presentModalViewController:imagePickerController animated:YES];

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissModalViewControllerAnimated:YES];
    _myImageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}

I know this way I can take picture but automatically How I do accomplish?

1条回答
走好不送
2楼-- · 2019-05-05 07:33

You can use the takePicture method on UIImagePickerController to take a picture programmaticly.

But I suggest to use AVFoundation to create you onw image capture.

查看更多
登录 后发表回答