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

前端 未结 2 1566
耶瑟儿~
耶瑟儿~ 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条回答
  •  故里飘歌
    2021-02-18 16:17

    I was trying to do this today, and I was able to get it working with the following code:

    [UIView transitionWithView:imagePickerController.view duration:1.0 options:UIViewAnimationOptionAllowAnimatedContent | UIViewAnimationOptionTransitionFlipFromLeft animations:^{
                imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
            } completion:NULL];
    

    I hope this helps anyone who comes across this question.

提交回复
热议问题