如何创建自定义摄像头视图,而不是UIImagePickerViewController? [英] How do you create a custom camera view, instead of UIImagePickerViewController?

查看:133
本文介绍了如何创建自定义摄像头视图,而不是UIImagePickerViewController?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用UIImagePickerViewController创建了一个简单的应用程序,用于从相机捕获,但是我想自定义从相机抓取的界面,例如添加一些按钮。



UIImagePickerViewController不允许直接使用,那么如何创建一个自定义视图,允许显示实时摄像机馈送并从中捕获?

解决方案

简单的方法是继续使用 UIImagePickerViewController ,但设置 showsCameraControls 到NO,并使用 cameraOverlayView 提供您自己的用户界面。



但更灵活)的方法是使用 AVFoundation 类别(特别是 AVCaptureVideoPreviewLayer AVCaptureStillImageOutput )构建自己的相机。

I created a simple application using UIImagePickerViewController for capturing from the camera, but I'd like to customize the interface for grabbing from the camera, such as adding some buttons.

UIImagePickerViewController doesn't allow this directly, so how would you create a custom view that allows for displaying the live camera feed and capturing from it?

解决方案

The easy way is to continue to use UIImagePickerViewController but set showsCameraControls to NO and provide your own user interface using cameraOverlayView.

The more difficult (but more flexible) way is to use the AVFoundation classes (particularly AVCaptureVideoPreviewLayer and AVCaptureStillImageOutput) to construct your own camera.

这篇关于如何创建自定义摄像头视图,而不是UIImagePickerViewController?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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