1 year ago
#382695
Tony Merritt
Segue to Tab in navigation controller going to wrong tab, Swift, Xcode
I am clicking a button and pushing to a TabBar Controller.
When I click the button it goes to the first tab only, no matter what number I put in the prepare for segue area.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let barViewControllers = segue.destination as! UITabBarController
let nav = barViewControllers.viewControllers![2] as! UINavigationController
let destinationViewController = nav.topViewController! as UIViewController
}
The one it should go to is the one with the brown background (Number 2, Third Tab)
swift
xcode
storyboard
uitabbarcontroller
segue
0 Answers
Your Answer