0
View Controllerをポップオーバーとして表示しようとしていますが、フルスクリーンで表示されているときにiPhone上で正常に動作しますが、iPadではクラッシュします。iPadでPopover View Controllerがクラッシュする
@IBAction func selectOpponentItems(_ sender: UIButton) {
let VC = storyboard?.instantiateViewController(withIdentifier: "ItemSelectionVC") as! ItemSelectionVC
// Error here
VC.delegate = self
VC.preferredContentSize = CGSize(width: UIScreen.main.bounds.width/2, height: UIScreen.main.bounds.height/2)
VC.modalPresentationStyle = UIModalPresentationStyle.popover
self.present(VC, animated: true, completion: nil)
}
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return .none
}
エラーメッセージは言う:
は 'Overpower.ItemSelectionVC' (0x10005ad40)にタイプ 'の値のUIViewController'(0x1b1e33f60)にキャストできませんでした。
例外メッセージとは何ですか?どのラインで発生するのですか? – Paulw11
@ Paulw11 plz編集 –
あなたのストーリーボードをチェックするのは、ItemSelectionVCではなく単にUIViewControllerであるため、強制ダウンキャストは失敗します。 – Paulw11