I'm using 4 tab bar view controller. On submit button on first tab view controller to a sub view controller. I want to go second tab view controller as shown in the screenshot.
Asked
Active
Viewed 170 times
0
-
[@Nicolas Miari](http://stackoverflow.com/users/433373/nicolas-miari) [@Nirav D](http://stackoverflow.com/users/6433023/nirav-d) Please tell me current answer switching between tabview controllers to sub view and sub view to second tab view controller – Arjun Yadav May 18 '17 at 05:35
-
What do you mean by **switching between tabview controllers to sub view and sub view to second tab view controller** ?, have you tried `self.tabBarController?.selectedIndex = youtTabbarIndex` tabbar index start from `0`, set index of tab you want to move – Nirav D May 18 '17 at 06:08
-
sir , i wanna click submit button and go to second tab as like image – Arjun Yadav May 18 '17 at 06:24
-
Then on button action of this submit button simply add line `self.tabBarController?.selectedIndex = yourTabbarIndex` here `yourTabbarIndex` is index you want to move in tabbar – Nirav D May 18 '17 at 06:26
-
On clicking Submit(){ dismiss presentViewController} and then in tabVC's viewDidAppera(){ self.selectedIndex = 1} . You also need to write condition here. – Ruhi May 18 '17 at 06:28
-
thank god @RinkiNegi you understand what i'm say but please tell me viewdidApper() conditions – Arjun Yadav May 18 '17 at 07:02
-
`self.dismiss(animated: true) { //use delgate to identify that controller is dismissed and show your required tab bar }` – Maddy May 18 '17 at 07:27
-
1@ArjunYadav you have to create global boolean variable , whose value you need to change on clicking submitbuttonClicked() and then in TabbarView Controller viewDidAppear(){ if btnTapped == true{ self.tabBarController.selectedIndex = 1 } – Ruhi May 18 '17 at 07:33
-
@RinkiNegi don't you think delegate would be a better way. – Maddy May 18 '17 at 07:39
-
@NiravD don't you think that the question should not be marked as duplicate. – Maddy May 18 '17 at 07:41
-
@Maddy thanks a lot to understand my question. i'm searching a lot on stackoverflow regarding that question. But couldn't find any suitable match regarding my requirement. – Arjun Yadav May 18 '17 at 07:48
-
@Maddy Check the question title and duplicate question both are same if this question edited with other requirement than Its possible to open the question – Nirav D May 18 '17 at 09:13
-
1@ArjunYadav i have created a sample, hopefully it will solve your problem. https://github.com/Maddybarak/SwiftyTabBar/ – Maddy May 18 '17 at 11:36
-
@Maddy thanks dear , this work perfectly ... – Arjun Yadav May 18 '17 at 12:06