UIImagePickerController how to do animated switch from rear to front camera?

前端 未结 2 1546
耶瑟儿~
耶瑟儿~ 2021-02-18 15:59

I have been using custom overlay for UIImagePickerController controller, and everything is working fine. I have added button to switch between front and rear camera

2条回答
  •  闹比i
    闹比i (楼主)
    2021-02-18 16:33

    Here's the Swift code for the accepted answer in case someone needs it:

    UIView.transitionWithView(imagePickerController.view!, duration: 1.0, options: [.AllowAnimatedContent, .TransitionFlipFromLeft], animations: {() -> Void in
                imagePickerController.cameraDevice = .Rear
                }, completion: nil)
    

    Thanks Pablo!

提交回复
热议问题