在 iPhone 上拍照而不显示控件 [英] Take a picture on iPhone without showing controls

查看:18
本文介绍了在 iPhone 上拍照而不显示控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 iPhone 上用代码拍照而不通过 Apple 控件?我见过很多应用程序可以做到这一点,但我不确定要使用什么 API 调用.

Is there a way to take a picture in code on the iPhone without going through the Apple controls? I have seen a bunch of apps that do this, but I'm not sure what API call to use.

推荐答案

是的,有两种方法可以做到这一点.一、iOS 3.0+可用的是使用UIImagePickerController类,将showsCameraControls属性设置为NO,将cameraOverlayView属性设置为自己的自定义控件.二,在 iOS 4.0+ 中可用的是配置 AVCaptureSession,使用适当的相机设备为它提供 AVCaptureDeviceInput,以及 AVCaptureStillImageOutput.第一种方法更简单,适用于更多 iOS 版本,但第二种方法可以让您更好地控制照片分辨率和文件选项.

Yes, there are two ways to do this. One, available in iOS 3.0+ is to use the UIImagePickerController class, setting the showsCameraControls property to NO, and setting the cameraOverlayView property to your own custom controls. Two, available in iOS 4.0+ is to configure an AVCaptureSession, providing it with an AVCaptureDeviceInput using the appropriate camera device, and AVCaptureStillImageOutput. The first approach is much simpler, and works on more iOS version, but the second approach gives you much greater control over photo resolution and file options.

这篇关于在 iPhone 上拍照而不显示控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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