I need to add an imagePicker.view to the view instead of presenting it.
But when the image picker view comes up, I see a white background in Darkmode.
Is this a bug? Or is there a way to fix it?
import UIKit
class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@IBOutlet var mainView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .systemBackground
}
@IBAction func btnTouched(_ sender: Any) {
let imagePicker = UIImagePickerController()
imagePicker.sourceType = .savedPhotosAlbum
imagePicker.delegate = self
self.addChild(imagePicker)
self.view.addSubview(imagePicker.view)
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.removeFromParent()
picker.view.removeFromSuperview()
}
}