0

I have been searching for a solution for 6 hours, and come up with nothing that applies to my situation. my storyboard follows the flow of:

TabBarViewController -> NavigationController ->TableViewController -> UIViewController (see picture below)

Picture of StoryBoard

When the "Notify" button, in the last view controller (Stranger view controller), is clicked, I want to programmatically transition/segue from that View Controller(Stranger View Controller), to a different child of the TabBarViewController (it is the controller titled "Look Around" within the illustration).

Every time I perform a traditional segue:

  1. option + drag segue from Stranger View Controller --> Look Around View controller
  2. Give segue an identifier
  3. programmatically use self.performSegueWithIdentifier.

I get a transition. but the "Look Around" tab bar is gone in the storyboard, and in the simulator, once I hit "Notify", the view changes to the "look around" view, but the tab bar below does not reflect that change, as it still has the previous tab highlighted.

I have already handled all the other processing within the IBAction function that I need to handle. It is just a matter of, correctly, sending the user to a different view, once they have hit "Notify".

Any guidance on this would be greatly appreciated.

If you have any questions or concerns for me, please do not hesitate to ask. I am new at this, and am open to any help.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Robbie Robinson
  • 389
  • 1
  • 3
  • 14

1 Answers1

1

ViewController is a child of NavigationBar and NavigationBarController is a Child of TabBarController. So Segue is not required as it will disturb the flow.

Try programmatically

@IBAction func notifyButtonTapped(sender: AnyObject) {
        tabBarController?.selectedIndex = 1
        tabBarController?.tabBar.hidden = false
        self.navigationController?.popToRootViewControllerAnimated(false)
    }
Rahul Katariya
  • 3,528
  • 3
  • 19
  • 24
  • This definitely did the trick! Thank you so much for your help. Other than studying this code, I think I need to find a solid tutorial on transitions, and when, and when not, to use segues. – Robbie Robinson Apr 10 '16 at 11:31
  • Also study about containment - parent child relationship of view controllers. – Rahul Katariya Apr 10 '16 at 13:24