Reputation: 21
So I have a tabbed application, and I'm really new to xCode. I created a first view.
So I need help with code for the Quotes button to help lead me to the tab bar controller. Thanks
Upvotes: 0
Views: 81
Reputation: 61
let storyboard = UIStoryboard(name: "StoryboardName", bundle: nil)
let tb = storyboard.instantiateViewControllerWithIdentifier("Storyboard ID") as! UITabBarController
self.presentViewController(tb, animated: true, completion: nil)
To return from TabBarController
self.dismissViewControllerAnimated(true, completion: nil)
Upvotes: 0
Reputation: 3526
click on button press and hold control and drag it to another view controller some actions will pop than select the first option show and you are ready to go.
Upvotes: 0
Reputation: 1036
First of all, it looks like you're using a custom segue and it looks like you don't actually need it in your situation.
There is a simple solution by changing the segue Kind
to Show (e.g. push)
. This will simply show the connected view controller on top of your first viewcontroller.
This won't allow you to navigate back to the first view controller. If you want to do so, click on the first view controller in your storyboard and go to Editor > Embed in > Navigation controller.
This will automatically add a navigation controller which will manage the default navigation for you.
Upvotes: 0
Reputation: 2361
It looks like you have a programmatic ("custom") segue in the view controller. This probably isn't what you want.
In Interface Builder, select that segue and in the Attributes Inspector, change the kind of segue to "Show (e.g. Push)".
Upvotes: 1