自动拍照
我尝试使用 UIImagePicker 和 AVFoundation 自动拍照并将其保存到照片库,但我无法使其工作。
我想在视图出现时拍摄照片,而不向用户显示相机视图,然后将其用作应用程序中的简单图像。
谢谢
I have tried to take a picture and save it to the photo library automatically with UIImagePicker and AVFoundation, but I couldn't make it work.
I would like to take the photo when the view appears, not showing the camera view to the user, and then use it as a simple image in the app.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
苹果实际上有一整套专门针对此类内容的指南,“iOS 相机编程主题”,其中有一个“拍摄照片和电影”小节。甚至还有一个示例项目“照片选择器”。以下是拍照按钮的操作方法摘录:
注意:除非
[UIImagePickerController isSourceTypeAvailable:
返回 YES,表示设备有摄像头。UIImagePickerControllerSourceTypeCamera]
Apple actually has an entire guide devoted to this sort of thing, "Camera Programming Topics for iOS," with a subsection "Taking Pictures and Movies." There's even a sample project, "Photo Picker." Here's an excerpt, the action method for your take-a-picture button:
Note: It won't work unless
[UIImagePickerController isSourceTypeAvailable:
returns YES, indicating that the device has a camera.UIImagePickerControllerSourceTypeCamera]