Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Tom Coomer
1,331 PointsSwitching views in storyboard with segmented control.
I have 3 views in my app which are currently being switch between using buttons. However I would like to change this so they switch with a segmented control. Each view has its own view controller with .h and .m files. How would I do this?
2 Answers
Tom Coomer
1,331 PointsOk. Each view has multiple timers inside them through their files. Will I need to put them all in to the same .m file?
Amit Bijlani
Treehouse Guest TeacherYou don't need to create a separate view controller for each view. You should have all three views in the same view controller and just show / hide them based on which segment was clicked within the segmented control.
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherCan you please elaborate on this
Tom Coomer
1,331 PointsTom Coomer
1,331 PointsAt the moment the game has 3 views and inside each has a timer. Each of those views have their own .m and .h files.
This is the game.
https://itunes.apple.com/gb/app/reaction-timer-game/id572319874?mt=8
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherYou can solve this problem several ways. Using a tab controller or some other third party controller like JASidePanels
Tom Coomer
1,331 PointsTom Coomer
1,331 PointsOkay. Thanks very much.