iOS从相机没有modalViewController的照片 [英] iOS take photo from camera without modalViewController

查看:137
本文介绍了iOS从相机没有modalViewController的照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从相机获取照片,但我需要使用它在我的UIViewController。

I need get photo from camera, but I need use it in my UIViewController. I have custom button for take photo.

我不想像这样使用

-(void) takePicture:(id) sender 
{
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

    if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) 
    {
        [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
    }
    else 
    {
        [imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    }
    [imagePicker setDelegate:self];
    [self presentModalViewController:imagePicker animated:YES];
}

我想使用来自camera的流创建自定义ViewController,我怎么能做到呢?谢谢

I want create custom ViewController with stream from camera, like instagram. How I can do it? Thank you

推荐答案

您可以使用AVFoundation拍照。阅读有关它的苹果文档: AVCaptureDevice

You can use AVFoundation for take photos. Read apple's documentation about it : AVCaptureDevice

这是苹果的示例代码。 AVCam

Here is a sample code by apple. AVCam

在这里,我找到了一个教程:链接

Here I found a tutorial: link

另一个stackOverflow问题,在这里有一个很好的示例代码我认为:

Another stackOverflow question, and in this there is a good sample code I think: link

另一个有用的链接:链接

这篇关于iOS从相机没有modalViewController的照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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