1
사용자가 사진을 찍는 iOS 앱을 개발 중입니다. 그러나 사용자가 전면 카메라를 사용할 수 있어야합니다. 즉, 후면 카메라에 접근해서는 안됩니다. 현재, 내 코드는 다음과 같습니다.iOS 앱에서 후면 카메라 사용을 제한하는 방법
@IBAction func takePicture(sender: UIButton) {
if UIImagePickerController.availableCaptureModesForCameraDevice(.Front) != nil {
let imagePickerController = UIImagePickerController()
imagePickerController.sourceType = .Camera
imagePickerController.allowsEditing = false
imagePickerController.cameraDevice = .Front
imagePickerController.delegate = self
presentViewController(imagePickerController, animated: true, completion: nil)
}
else {
let alertVC = UIAlertController(
title: "No Camera",
message: "Sorry, this device has no camera",
preferredStyle: .Alert)
let okAction = UIAlertAction(
title: "OK",
style:.Default,
handler: nil)
alertVC.addAction(okAction)
presentViewController(alertVC,
animated: true,
completion: nil)
}
}
기본값은 카메라의 전면을 향하게하지만 여전히 사용자가 후면 카메라로 전환 할 수있는 선택권을 제공합니다. 이 기능을 제한 할 수있는 방법이 있습니까? 당신이 사용자에게 UIImagePickerController를 제공하는 자유를 허용하지 않으려면 미리