Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ryan Coughlin
1,677 PointsPerforming a segue with a UITabBar
I am trying to search for a some resources on performing a segue between tabs using a UITabBar
controller. I cant find anything directly related to this. Only segues between 2 view controllers (without a UITabBar
).
Any ideas on how to do this? Essentially I am trying to pass a NSDictionary
to my second tab in my UITabBar
Thanks!
Ryan
3 Answers

John W
21,558 PointsTab bar or tool bar? Tool bar goes with navigation controller and tab bar goes with tab bar controller.
If it's toolbar, simply link an IBAction outlet and call performSegue:
Otherwise, you just have to set it up in storyboard (or programmatically if you feel ambitious)

Ryan Coughlin
1,677 PointsUITabBar
has the UITabBarController
(should have rewrote it above).
If it was a UINavigationBar
I would create an IBAction
(the part im confused on is creating it with UITabBarController
. I dont see how I would create the segue ID to each tab on the bar bar vs making a button -> segue -> view.
UITabBarControler
has 2 tabs - these 2 views are the only views within my app.
In short:
"A user will land on Tab 1 and when a user taps Tab 2 --> ---perform segue here to send data to this view---".
Thoughts?

Ryan Coughlin
1,677 PointsSolved this issue with creating a Singleton an calling that method where I needed to access that model:
+(TideModel*)tideSingleton {
static TideModel* tideSingleton;
if(!tideSingleton){
@synchronized(tideSingleton){
tideSingleton = [TideModel new];
}
}
return tideSingleton;
}
Example of calling it here:
[TideModel tideSingleton].tideDic = [[NSDictionary alloc] initWithDictionary:json];