2017-01-17 9 views
1

私は自分のtabBarControllerの特定のインデックスを提示したいが、最初に別のカスタムViewControllerを実行する。上記画像におけるTabBarControllerの現在のタブ親ViewControllerを通して

enter image description here

。私は自動的に私のTabBarコントローラを提示する、黄色のviewcontrollerを提示したいが、私はタブバーコントローラが特定のインデックスを表示したい。

私は以下のコードと黄色のViewController提示:どのように私はロードに行くか

let tbc = self.storyboard!.instantiateViewController(withIdentifier: "MyTabController") as! UITabBarController 

tbc.selectedIndex = 1 
tbc.modalPresentationStyle = .overCurrentContext 
tbc.modalTransitionStyle = .coverVertical 
self.present(tbc, animated: true, completion: nil) 

:tabBarController上のタブを提示するとき、私は次のコードを使用することになり、通常

 let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil) 
     let tbc = storyBoard.instantiateViewController(withIdentifier: "SWRevealViewController") as! SWRevealViewController 
      tbc.modalTransitionStyle = .crossDissolve 
     self.present(tbc, animated: true, completion: nil) 

を黄色のビューコントローラを介してタブバーの特定のインデックス?

答えて

0

このような状況では、私は通常、黄色のコントローラーからtabBarController(必要に応じてインスタンス変数を使用)に必要なインデックスを渡します。これは、タブバーコントローラーによって必要なインデックスに設定できます。

関連する問題