以编程方式拍照而无需用户交互 [英] Programmatically Take Picture Without User Interaction

查看:66
本文介绍了以编程方式拍照而无需用户交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在没有用户交互或不显示ImagePickerController的情况下拍摄图片

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?

推荐答案

您可以使用 takePicture 方法在 UIImagePickerController 以编程方式拍照。

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

但是我建议使用 AVFoundation 来创建一次图像捕获。

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

这篇关于以编程方式拍照而无需用户交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆