测试 iPhone4 上的前置或后置摄像头
我编写了一个应用程序,使用 UIImagePickerController 设置一些相机值(持续时间、质量等),并且工作正常。然而,在 iPhone 4 上,我从前置摄像头开始,如果用户切换到后置摄像头,质量设置就会丢失。有没有办法可以测试用户是否在前置摄像头和后置摄像头之间切换?
通过使用
if (imagePicker.cameraDevice=UIImagePickerControllerCameraDeviceFront) ,
它会告诉我相机是否设置为前置摄像头,但如果用户使用屏幕切换器切换相机,它不会返回相机值。
任何帮助将不胜感激。
I wrote an application that sets some camera values (duration, quality, etc) using UIImagePickerController and it works fine. However, on an iPhone 4, I start with the front camera and if the user switches to the rear camera, the quality settings are lost. Is there a way that I can test if the user switches between the front and rear camera?
By using
if (imagePicker.cameraDevice=UIImagePickerControllerCameraDeviceFront)
it will tell me if the camera is set to the front camera but if the user switches cameras using the screen switcher, it won't return the camera value.
Any help here would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要 AVCaptureDevice 通知:
观察它们并做出相应反应。
You probably need AVCaptureDevice notifications:
Observe them and react accordingly.