How can I have multiple viewcontrollers in UIPageViewController display at once - ios

I'm trying to have multiple viewControllers show in a single frame of a UIPageViewController. With the current page being centred in the UIPageViewController and the previous and next cards showing on the edge of the screen
I've been struggling to find a solution. Any help would be much appreciated.
-> Like this <-

I don't think you can do what you are describing. A page view controller shows one page, or 2 pages with a spine in the middle. It has pages "waiting in the wings" for when the user flips/slides new pages, but I don't think it supports showing pages off the edge.
That said, it wouldn't be that hard to create your own parent/child view controller arrangement that does what you want. you might even be able to base it off of a UICollectionView.

Related

UICollectionView vs UIPageViewController

I need to have different full screen views in my app. Very similar to how snapchat works. The views should be able to communicate between each other.
My question is: Should I use a UICollectionView with cells same size as the screen or should I use UIPageViewController?
Please provide some background info to support your opinion!
I think both have pretty different purposes.
UICollectionView is great to build a mosaic of views (think an image gallery for instance), whereas UIPageViewController is kind of similar to the flipping pages of a book. The latter seems to be what you need, but UIPVC doesn't seem to offer many tweaking/customizations, like custom transitions for example. In which case you may want to start from a UIScrollView with paging enabled to recreate something similar but with more potential. Here's an example.
Personal opinion: for this specific case I'd use a page view controller. Collection views have any things you have to consider, like when the device rotates you have to recalculate where you are, which cell you have to display, ask to scroll to the current cell, and if you are displaying a video or using the camera you might have to control it perfectly, otherwise issues will come.
However think about new features that might be added to your app, if you think you might show more than 2 items on screen, then you'd better choose a collection view.
A page view controller lets the user navigate between pages of
content, where each page is managed by its own view controller object.
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPageViewControllerClassReferenceClassRef/
So If you plan to swipe from one ViewController to another, go for PageViewController. If you plan to have only one ViewController that deal with a list of fullscreen image or so, go for a view controller with a collectionView, or maybe your own swipeView.
UIPageViewController use different view controller and load multiple controller so obvisioly take more memory as compared to UICollectionView. So if your required task is less calculation or step to do then its recommended to use UICollectionView, other case preferred way is to user UIPageController.

How do I create a horizontal scroll view with unlimited pages?

I am trying to make an app that you can scroll through and it displays a different string on each page. I though I should use scroll views as they seem to be how I can do this. An example of what I want is UberFacts app. This app you can scroll along and it has a different fact each time. This is obviously not just thousands of different view controllers that are linked by the page control. How do I make view controllers work like UberFacts?
Thanks!
UberFacts seem to use a paginated ScrollView and each page looks like a vertical ScrollView also (you can see by the bounce). But is just one ViewController that manage all those pages.

UIPageViewController overscroll is occurring

I'm using UIPageViewController to house several different UiViewControllers (6 total).
When on the first or last Page of the Controller, I can scroll the Page partially out of view. Is there a way to prevent this? I want scrolling for the interim pages, but don't want the first or last page to move of the screen at all since there's nothing before or after them.
Any ideas here? I assume it should be a simple setting, but can't find it in the docs. Thanks!!!

Multiple Visible Pages in Scroll Style UIPageViewController

So what I'm looking to do is have a UIPageViewController that will end up displaying three view controller vies, one fully visible and then two as previews to the right and left. An example would be the iOS6 App Store:
Is doing this using a UIPageViewController set to UIPageViewControllerTransitionStyleScroll possible?
Basically I'd ideally like to have is a case where I can have three UIViewControllers that I recycle as the user pages through the 1- items in the list (with n being at least 50). I know an interface that behaves like this can be done with a UIScrollView with paging enable, but re-using views would take some view shuffling code that I'd rather not write if Apple has already done it for me.
I'm totally comfortable with the fact that this is iOS6 only, by the way, and also comfortable with alternatives, if they exist.
Thanks!
Check the new collection view. I think you may be able to create something like that with reusing cell etc.

iOS: How to get swipe effect between views of tabbed view controller?

I keep seeing apps that appear to be tabbed view controller apps, where the user can easily swipe left or right between views.
How do I enable that kind of behavior?
Thanks.
The best and least hassle free solution I found is Andrey Tarantsov's ATPagingViev class. Works just like a UITableView, i.e. how many pages do you want, scroll horiz or vert. provide view for page, etc. Very easy and well coded. It's here: SoloComponents
It also has a recycling feature so it's memory stable.
If you refer to something like Apples photo app, it is using UIScrollView which has a property to enable paging.
If you define the views content width wider than your view's frame, you'll get the effect you describe. The view will page in steps of it's bounds width.
On each page you can place another view.
http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIScrollView_Class/Reference/UIScrollView.html
Another option I found is SwipeView:
https://github.com/nicklockwood/SwipeView

Resources