私は写真を撮るためにUIImagePickerController
を提示しています。写真を撮るか、キャンセルするかどうかです。UIImagePickerController
私は前回のViewController
で白い画面に戻ります。私のnavigation bar
だけがまだここにあります。他のview
(ナビゲーションバー付き)をクリックしてもOKですが、UIImagePickerController
と呼ばれるタブに戻ると、まだ白です。現在のUIImagePickerControllerの後に白い画面
let picker = UIImagePickerController();
picker.delegate = self;
picker.mediaTypes = [swiftString];
picker.allowsEditing = true
picker.sourceType = UIImagePickerControllerSourceType.camera;
picker.cameraCaptureMode = .photo
self.present(picker, animated:true, completion:nil);
却下:
picker.dismiss(animated: true, completion:nil);
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion:nil);
}
誰かがアイデア感謝の持っている場合は!
更新:私はpresent method
との見解を呼び出すとき
白い画面が常に表示されます。誰かがそれを解決するために、他の選択肢を持っている場合
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {return}
appDelegate.navigationController.present(picker, animated: true, completion: nil)
:だから私は、これは私の問題を解決する
それはナビゲーションコントローラ(階層...)との競合だと思います!
から
.modalPresentationStyle
を設定し、あなたが 'UIImagePickerController'を却下されている方法は? – Poles@Polesもちろん、ポストはそれを示すように編集されています – Makaille
イメージピッカーに必要なクラスをUINavigationControllerDelegateのサブクラスにしてもよろしいですか? – pbush25