Add parallax scrolling to UIPageViewController - ios

I am using a UIPageViewController (and was even thinking about starting to use Pageboy) and recently saw an app using parallax scrolling as shown here (AnimatedCollectionView). Since I really liked the way parallax scrolling felt but cannot use a UICollectionViewController (and simply use the last mentioned pod) for my purposes due to a variety of reasons, I was wondering whether there was a way to add interactive scrolling animations or rather parallax scrolling to a UIPageViewController as well. At the end of the day the UIPageViewController is still inherited from UIScrollView (just like: UITableViewController and UICollectionViewController), right? Please correct me if I'm wrong.
Nevertheless, the question remains: How can I add parallax scrolling to a UIPageViewController? Is it even possible? Unfortunately, I couldn't find anything that could help me.
I am not sure if it might be of any interest but the UIPageViewController I am using is horizontal.

Related

How to pin an image/view inside a UIScrollView when scrolling

I've been searching for a way to pin views/images to the top of a UIScrollView when scrolling. However the posts/articles I came across are not in swift 3. I'm not sure if I'm typing my question in the web correctly. So my question is how can we achieve the same behavior as a UITableView or UICollectionView. When you scroll, a section will stick to the top until another section pushes it up. I'm wondering would we be able to use views/image and pin them at the top of the UIScrollView. Down below is a screenshot of a UIScrollView that has 4 views.
So when scrolling I would like to pin the first view/image to the top until another view/image pushes it. Also would it be possible to determine which view sticks to the top. So lets say I only want the red views to stick until another red view pushes it. Been looking for a way to achieve this type of behavior for a while now.
Please help, would really appreciate any help provided at this point. Thanks.
A few ways to do this, but you can use the scrollView delegate’s scrollViewDidScroll to capture the contentOffset and use a combination of the target view’s origin/center/transform properties to keep the view where you want it.
There’s a neat video explaining how to do this that Apple released during WWDC 2010, called something like “Advanced Scroll View Behavior”, if I remember correctly. It’s definitely worth a watch.

Make UIScrollView scroll from scrolling inside OR outside of it

Say I have a UIScrollView that scrolls horizontally just fine. It's height is around 50px. After usability testing, a lot of people are trying to scroll the contents by panning outside of it. Here is the setup:
Where it says "Amount" is the scrollview
I am wondering if it is possible to attach a UIPanGestureRecognizer on the blurred background it sits on top of and have it scroll along with that as well. If this is possible, could someone give me a start on what that approach would possibly look like?
Nah, the simple solution is simply make the scroll view bigger .. it's just that simple.
Have it mostly transparent, with your content sitting where you want it.
What you describe in your question is a good idea but it's extremely! hard to really implement well, a total pain. You simply "make the scroll view bigger".
Nice looking app.
These may be relevant to you...
The UICollectionView "swipe-away" in iOS7 app manager?
Show/hide UIToolbar, "match finger movement", precisely as in for example iOS7 Safari

iOS (iPhone only): Horizontal page scroll, where the scrolling page doesn't take up the whole screen

I am trying to achieve horizontal page scrolling effect (partial view, not of the entire screen scrolling), like in the HGPageScrollView component.
I am a fairly novice iOS programmer, and I am having difficulty finding the parts of the code which provide just the horizontal scrolling with the swipe gesture. So I am looking for any help, either some sample code, or pointers to the code in the HGPageScrollView, which provide just the horizontal scrolling functionality (i.e. not even the UIPageControl dots at the bottom, just the vanilla scroll).
I am only looking for an implementation which works in iPhone landscape orientation, if that makes it any easier.
Why I am not using HGPageScrollView:
It is not ARC compliant.
It does way more than I need it to, I am just looking for the scrolling.
Consequently, it is proving quite difficult for me to find where to remove all the features I do not need, like clicking on page to change the scrolling mode to full screen (HGPageScrollViewModePage)
I would like to use this as an incentive to learn more about the components available in cocoa-touch, and roll my own implementation.
I think this question might be suggesting the solution, but I do not know how to implement it. I guess I don't fully understand it, as there aren't enough details for my novice skills to go on.
Use a UICollectionView and set the pagingEnabled property to YES.
If you want to do complex layouts of the items (like in your example above where items are split on both sides of the screen) you may want to provide your on UICollectionViewLayout: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionViewLayout_class/Reference/Reference.html#//apple_ref/occ/cl/UICollectionViewLayout

UITableView vs UIScrollView

I am working on an animation application. I would like to have an horizontal UITableView or horizontal UIScrollView that will show little images representing a drawing at page X.
Since that my animation app can easily have 200 drawings, this means that my UITableView or UIScrollView can contain 200 images.
Finally, I would like to implement UIAnimation, where the user will be able to reorder the images by drag and dropping. I would like to have something smooth...
I have 2 questions :
Which classes is the better for memory management? I think I understood UITableView automaticly unload cells that are off screen, not UIScrollView. Is that true?
Which one might be easier to implement, considering possible heavy load? (I found this for horizontal UITableView : EasyTableView
Thank you
You should look into tiling with UIScrollView. There have been some very good sessions talking about advanced use of UIScrollView at WWDC over the past three years, and the videos of those sessions are available if you're a registered developer. They'll show you how to use UIScrollView's tiling feature to load just the content that you need, much as UITableView loads only the content that it needs.
As far as I'm aware, UITableView doesn't work in a horizontal mode, so UIScrollView is currently your only choice if you're only considering classes in Cocoa Touch. I'm sure there are some third party options, but I don't know enough to recommend one.

Fluid full screen view transitions on iOS

I have a simple app that has a set of coloured views, one red, one green and one blue.
I am trying to make it so that when a swipe gesture is made the current view will switch to the next one in the list in a fluid manner, it looks like moving a long piece of paper with different colours on it.
Is there a way to do this (CoreAnimation)?
You could first look into UIScrollView. It seems to me that what you are trying to accomplish is the same you have, say, in Mobile Safari on an iPhone, when you show all your current pages and can go from one to the next by scrolling. This tutorial is particularly close to what you describe.
If you are looking into more advanced kind of transformations, than Core Animation would be the option.
Actually, nothing prevents using both approaches, UIScrollView to handle the swipe, Core Animation to add more animation to the pack...
You could use a UIScrollView to accomplish this. Add all of your colored views as subviews to the scroll view. Make sure your contentSize is setup appropriately and optionally setup paging to make the scrolling always snap to a certain border. See the scroll view programming guide for more info Scroll View Programming Guide

Resources