相机闪光灯在 IOS 中使用 UIImagePickerController 自动/开/关 - Swift [英] Camera Flash Turn Auto/On/Off with UIImagePickerController in IOS - Swift

查看:15
本文介绍了相机闪光灯在 IOS 中使用 UIImagePickerController 自动/开/关 - Swift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 IOS Swift 很陌生.但我正在构建一个示例相机应用程序,它可以拍摄照片和视频,然后保存到照片库.但我希望用户在相机视图上选择自动/开/关闪光灯选项,当用户拍照时,闪光灯打开或关闭取决于他/她选择的选项.我正在使用 UIImagePickerController 来自定义相机功能.到目前为止,我无法获得太多关于如何在相机视图上打开/关闭功能以及在按下按钮时相机闪光灯同时工作的建议.

I am very new to IOS Swift. But I am building a sample camera app that takes picture and video and then saved to photo gallery. But I want user to choose Auto/On/Off Flash option on the Camera View and when the user takes the picture then flash turns on or turns off depending on option what he/she chooses. I am using UIImagePickerController to customize camera features. I couldn't get much suggestions so far on how can I able to On/Off feature on the camera view and the camera flash works simultaneously while pressing button.

是否已经在 UIImagePickerController 中提供了任何相机闪光灯功能?如果是这样,那么我如何添加或使用我到目前为止的代码,以便闪光和拍照一起工作.

Is there any Camera Flash capability presented in UIImagePickerController already? If so, then how can I add or use with my code I have so far, so flash and taking picture works together.

关于如何在我的控制器中添加闪光灯功能以及如何在拍照的同时工作的快速示例有任何帮助吗?有人可以指出我正确的方向.任何帮助将不胜感激.

Any help with the swift example regarding how can I able to add the flash capability in my controller and how to work at the same time while taking picture? Can someone please point me towards the right direction. Any help will be greatly appreciated.

推荐答案

UIImagePicker 有一个名为 cameraFlashMode 可以设置

UIImagePicker has a property called cameraFlashMode you can set

imagePicker.cameraFlashMode = .on

这篇关于相机闪光灯在 IOS 中使用 UIImagePickerController 自动/开/关 - Swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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