Reputation: 141
I have a general tabbed application in Swift. I would like to be able to trigger an action on the tabbarcontroller from a UIButton Touch within one of the view controllers.
The button is located in View Controller 2 and should trigger a segue back to view Controller 1 via the UITabbarController when touched.
Upvotes: 0
Views: 109
Reputation: 141
Found the answer:
@IBAction func buttonClicked(sender: AnyObject) {
self.tabBarController?.selectedIndex = 0
}
**use appropriate index for the tab you want to accesss
Upvotes: 1