2016-10-31 6 views
0

splitviewコントローラのようにipadで1面のカスタムテーブルビューと詳細を表示する必要があります。したがって、セル上のボタンを選択すると詳細が表示されます。コンテナビューを素早く2つのコントローラに分割する

私の問題は、詳細コントローラの表示に起因します。私は、デリゲートメソッド

let containerController = self.storyboard?.instantiateViewController(withIdentifier: "ContainerController") as! ContainerViewController 
containerController.reactionViewControllerResponse(selectedMechanism: selectedMechanism) 
self.navigationController?.pushViewController(containerController, animated: true) 

介して容器コントローラにテーブルビューのボタンからデータを送信し、容器内で、Iは、テーブルビューコントローラ

にこのラインに

override func viewWillAppear(_ animated: Bool) { 
    super.viewWillAppear(true) 

    if (selectedMechanism != "" && self.mechanismViewController != nil){ 
     self.mechanismViewController = self.storyboard?.instantiateViewController(withIdentifier: "MechanismController") as! MechanismViewController? 
     self.mechanismViewController?.selectedMechanism = selectedMechanism 

     self.addChildViewController(mechanismViewController!) 
     mechanismViewController?.view.frame = CGRect(x: self.containerView.frame.size.width/2, y: 0, width: self.containerView.frame.size.width/2, height: self.containerView.frame.size.height) 
     self.containerView.addSubview((mechanismViewController?.view)!) 
     mechanismViewController?.didMove(toParentViewController: self) 
    } 
} 

介ししかしにより詳細コントローラを作成します

self.navigationController?.pushViewController(containerController, animated: true) 

詳細コントローラは、同じコンテナコントローラには表示されず、別のコントローラでは表示されません。私はいくつかのことを試みましたが、何も表示されないか、別のコンテナにあります。

私を助けてください!

PS:私はsplitviewコントローラを使用していません。これは、インラインビューコントローラとしては必要ないので、私はすでに試してみましたが、画面全体にマスターのみを表示したり、 ..

答えて

0

問題が解決しました。デリゲートはひどくインスタンス化されました。 ありがとうございました:)

関連する問題