0

が私の「ParentViewController」からModalViewを提示しようとすると、やることを示しているが、何も本当にシミュレータ- 何も示していない、デバッグ出力にもかかわらず、彼らは、負荷

  • ParentViewController.swift(にのみ示しません定型のUIViewControllerコードを除くコード)は次のようになります。

    :マイストーリーボードには、次のセットを持ってい

  • override func viewDidAppear(_ animated: Bool) { 
        super.viewDidAppear(animated) 
        let modalViewController = ModalViewController() 
        modalViewController.modalPresentationStyle = .overCurrentContext 
        present(modalViewController, animated: true, completion: nil) 
    } 
    
    • ParentViewController

      • Defines Context =真
      • Provides Context =真
    • Segue

      • Kind:プレゼントモーダル
      • Presentation:現在のコンテキスト過
    • ModalViewController

      • Presentation:現在のコンテキスト過
  • viewDidAppearModalViewController.swiftのデバッグプリントステートメントは、少なくともこれらが実行されているように見えます。あなたのViewControllerはストーリーボードからのものである場合、あなたは、画面上に何も表示されない理由の問題がある可能性があり

+0

私はこのコードをチェックしました。すべてが大丈夫です。 –

+0

ModalViewController()のタイプは何ですか?多分それは提示されますが、何も見ることができません。ビューに背景色を設定してみてください。 ModalViewControllerクラスでは、self.view.backgroundColor = UIColor.yellowを設定します。 – vhong

答えて

1

は、その空白ので、thatsの、あなたは、そのビューなしのViewControllerのインスタンスを作成しているこの

let modalViewController = ModalViewController() 

にありますコードからのものであれば、storyboard.instantiateViewController(withIdentifier: "ModalViewController")のようなものを使用しなければなりません。loadView()

関連する問題