import UIKit
class DrawingTransistionViewController: UIViewController,
UIImagePickerControllerDelegate,
UINavigationControllerDelegate
{
override func viewWillAppear(_ animated: Bool)
{
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .camera
self.present(imagePicker, animated: true, completion: nil)
}
}
Currently when the code runs, it opens the camera but when you exit the camera the camera opens again because the view appears again. So I'm stuck in a constant loop. I want the camera to only open once when transitioning between the view. I've already tried viewWillDisappear(), viewDidAppear, and viewDidDisappear() but haven't had any success.
This is the only helpful documentation that I've been able to find but haven't had much luck with it. https://developer.apple.com/reference/uikit/uiviewcontroller#//apple_ref/doc/uid/TP40006926-CH3-SW18
Any ideas?
Thanks