如何通过处理快门按钮自动拍照

时间:2017-12-18 03:10:27

标签: swift3

了解iphone通过设置定时器具有自动拍照功能。然后按下快门按钮开始。

我想做类似的事情。那么如何在相机启动后以编程方式处理快门按钮。

- implement: UINavigationControllerDelegate, UIImagePickerControllerDelegate 

class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate  {

var imagePicker: UIImagePickerController!


}

//-- launch the camera

  @IBAction func takePhoto(_ sender: UIButton) {

        imagePicker =  UIImagePickerController()
        imagePicker.delegate = self
        imagePicker.sourceType = .camera
        present(imagePicker, animated: true, completion: nil)
    }

因此,在相机启动后,如何以编程方式处理快门按钮,如点击它拍照?

1 个答案:

答案 0 :(得分:1)

  

因此,在相机启动后,如何以编程方式处理快门按钮,如点击它拍照?

告诉UIImagePickerController takePicture