説明が困難であるため、実現したい項番ごとに説明いたします。
コードのみの実装とします。
1.TabBarContollerとNavigationControllerの同時実装。
2.SecondViewControllerからのみ遷移できるThirdViewControllerの実装。(SecondViewControllerのrightButtonItemにて画面遷移)←ここまで実現できました。
3.ThirdViewControllerにもTabBarを表示。(その際、TabBar内のリストはfirstとSecondのみ)
4.ThirdViewControllerにもNavigationControllerを配置する。(SecondViewControllerからのみの遷移のため、戻るボタンを押した時にはSecondViewControllerに戻る)
要約すると、TabBarの内容は[first, second]のみでThirdViewControllerでもTabBarControllerとNavigationControllerを使用したいです。
現在のTabBarのソースは以下になります。(swift4)
TabBarController
1/* 2 * タブバー制御処理 */ 3class TabBarController: UITabBarController { 4 5 override func viewDidLoad() { 6 super.viewDidLoad() 7 8 //TabBarController設定 9 var firstViewController = FirstViewController(); 10 var secondViewController = SecondViewController(); 11 firstViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .featured, tag: 1); 12 firstViewController.tabBarItem.title = "first"; 13 secondViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .bookmarks, tag: 2); 14 secondViewController.tabBarItem.title = "second"; 15 let tabBarArray = NSArray(objects: firstViewController!, secondViewController!); 16 self.setViewControllers((tabBarArray as! [UIViewController]), animated: false); 17 18 //NavigationController設定 19 let navi1 = UINavigationController(rootViewController: firstViewController); 20 let navi2 = UINavigationController(rootViewController: secondViewController); 21 setViewControllers([navi1, navi2], animated: false); 22 } 23 24 override func didReceiveMemoryWarning() { 25 super.didReceiveMemoryWarning() 26 } 27}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。