2017-06-15 48 views
0

我正在用固定的頂欄和底部的一些固定按鈕構建一個應用程序。在我的MainViewController中間,我希望有一些表格可以在它們之間切換。我想這樣做的方法:爲了解決這個問題Swift:在ViewController中通過ViewController單擊到ViewController的Storyboard解決方案

  • 單擊底部
  • 點擊按鈕,按鈕在我的表

我把我的ContainerView裏面MainViewController。它適用於我已經通過點擊底部的一個按鈕切換InsideViewControllers。我用編程方式用Apples Tutorial解決了它。通過點擊一個按鈕,我改變了我的ContainerView的childViewController。

單擊我的InsideViewController中的按鈕時,我正在向我的ParentViewController(Container)發送消息。我通過實現一個協議並檢查我的parentViewController是否實現了它。

現在我的問題是,如果這是在我的ContainerView中從ViewController點擊到ViewController的最佳解決方案。還是有更好的方法來點擊我的表上的按鈕,並獲得下一個表?

我在想什麼可能是:

一個故事板的解決方案。我想在Storyboard中連接ViewControllers。所以,我在我的第一個視圖控制器上有一個按鈕,並從這一個到下一個ViewController執行一個循環。如果我這樣做就像解釋新的ViewController沒有填充容器。那裏彈出一個普通的ViewController到我的應用程序。這裏有一個例子這個想法的觀點:enter image description here

是否有可能或繼續發送消息給我的父母?

回答

0

當然可以。您可以開始閱讀Implementing a Container View Controller,特別是「在Interface Builder中配置容器」一節。在添加容器視圖的初始階段,您將自動在其中看到一個新的UIViewController。我猜如果你想要執行轉換,你將不得不Embed In導航控制器,新的視圖控制器。

enter image description here

相關問題