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
Taylor Smith
iOS Development Techdegree Graduate 14,153 Pointsswiping through different screens
I'm hoping this is super easy! I simply want to swipe left and right to navigate to different view controllers. I've tried messing with the swipe gesture recognizer and linking the view controllers...but I'm just stabbing in the dark. What's the easiest way to do it?
5 Answers
Cody Coats
7,469 PointsUIPageViewController probably would be your best bet rather than trying to do something custom.
Taylor Smith
iOS Development Techdegree Graduate 14,153 Pointsok thank you... I just have a hard time following the docs. I got it to go to the next page simply by swiping left and right... but it always comes up from the bottom as opposed to side to side. (just using normal view controllers that is). I'll experience with page view controllers. thank you!
Cody Coats
7,469 PointsPageViewController has options for Navigation Orientation and Directions that should allow you to configure where they transition from. This should be pretty easy to do using StoryBoard.
Taylor Smith
iOS Development Techdegree Graduate 14,153 PointsI'm having trouble getting anything to work. I'm not quite sure how to actually link my view controllers to the page view controller. The docs are too confusing for me (i'm a novice). This seems like it should be a simple task...but I'm having the hardest time!
I have 3 view controllers (view 1, view 2, view 3). then I dragged in the Page View Controller. Now what? lol!
**Amit Bijlani and Pasan Premaratne , any plans to have a quick section on this? :)
Cody Coats
7,469 PointsIn Xcode if you start a new project there is the choice of "Page based Application". This is done programmatically rather than in storyboard. Might give you a good starting point.
Also this tutorial might be good as well. It does a Page based application in storyboard.
Something I do when I get stuck on something like this is go to github and search for what you are trying to do. You can find quite a few complete projects that you can model.
Taylor Smith
iOS Development Techdegree Graduate 14,153 Pointsyeah i've tried to follow that tutorial...but I don't know objective C, i'm learning swift. I'll just keep plugging away i guess
Cody Coats
7,469 PointsYeah there aren't a lot of swift tutorials. I would watch the Obj-C videos here on treehouse so you can get used to translating Obj-C -> Swift