我关闭相机控制。这样做会关闭预览屏幕。所以从那里你可以制作我自己的预览屏幕(或者根本没有预览屏幕,我只是在调用 takePicture() 后使用照片。当你调用 takePicture() 函数时,你会得到你想要的回调正确远离是
let vc = UIImagePickerController()
vc.sourceType = .camera
vc.showsCameraControls = false
let mask = MyMaskXibClassMask(vc, self)
vc.cameraOverlayView = mask.view
vc.cameraOverlayView?.frame = self.view.bounds
self.present(vc, animated: true, completion:
{
if let camvc = vc.visibleViewController
{
camvc.addChild(mask)
}
})
MyMaskXibClassMask 有你的按钮来拍照和你需要的任何其他东西。然后也在我们的MyMaskXibClassMask下
@IBAction func take_picture()
{
camera.delegate = self
camera.takePicture()
}
当您调用“takePicture()”时,您的委托将被调用(因此您可以完全跳过预览)
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any])