How does Piictu implement both vertical and horizontal scrolling? - ios

The main view of the iOS app "Piictu" is a vertical scrolling list of photo albums. The thumbnails of each album are displayed inline and scroll horizontally.
If you swipe down or up from any point the parent view scrolls vertically, even when the starting point of the gesture on an album thumbnail.
What's your best understanding of how this is done? A vertical swipe gesture recognizer on the parent view and a horizontal swipe gesture recognizer on the album child/sub views?
Or, is this perhaps a UIWebView?
Thanks!

It's a lot simpler than that, or at least it can be done a lot simpler: just nest scroll views. The outer one covers the whole screen and only allowing vertical scrolling. Each series of thumbnails is contained in another, smaller scroll view which only allows horizontal scrolling. I've used this technique myself for an app I was contracted to develop.

Related

Change the scrolling recognition to be more vertically strict?

My application consists of multiple pages by scrolling horizontally - done by having 2 swipe gesture recognizers over the whole ViewController. On every page I have a ViewTable with items that scroll vertically.
Unless I do a perfect horizontal swipe, the TableView takes over the recognition and does a slight vertical scroll on the table rows.
How do it change the scrolling recognition angle for TableView? Because the table's vertical scrolling is responding from touches around 10º ~ 170º. Whereas I'd like them to be 45º for each direction. How do I narrow that angle? So that my main left/right pages respond easier without having to try to do a perfect horizontal swipe.
I have not really made such a gesture but this is how I think this can be achieved. This is similar to ViewPager on Android. You can use a normal Gesture Recognizer over UITableView, calculate how much x and y displacements are there and then decide whether you want to handle the horizontal scroll yourself by shifting the page or pass the control down to UITableView.
But if you keep your Gesture Recognizer below UITableView, you will never get the control to act upon the gesture unless UITableView passes down to you.

Horizontal Parallax Effect - Relative motions between views

I need a parallax scrolling effect. Something like Make My Trip app home page screen.
Any suggestion please. Demos or examples.
You can create two collectionviews with different item sizes and minimumInteritemSpacing.
Keep user interaction enabled for the collectionview at front but disable it for the other collection view.
On horizontal scroll of front collectionview, scroll the rear collectionview as well.
You can use scrollViewDidScroll method for this and scroll the rear collectionview accordingly.

How to enable UITableView swipe to delete along with horizontal page swiping

In one of my app, I am having multiple table views inside a horizontal scroll view. So, user can horizontally swipe between table views. I am not using UIPageViewController for some reason.
The problem that I am facing is that I have swipe to delete feature on my UITableView but does not work when I have multiple pages in the horizontal scroll view.
Is there an elegant way to provide both the features at the same time?
You can subclass UIScrollView and implement UIGestureRecognizerDelegate. Then return true in gestureRecognizer(_:,shouldRecognizeSimultaneouslyWith) for the appropriate recognizers.

multiple view controllers with tableview inside scrollview

I have 3 viewcontrollers inside a UIScrollView that page horizontally. each viewcontroller has a tableview within it.
I can swipe between the 3 viewcontrollers easily when the active table is still (not scrolling) - but when i try to page left or right when the tableview is moving it seems to ignore the touch and gets stuck. I have to stop the tableview with a touch before paging (almost as if the tableview is trying to receive the horizontal gesture)
how can I make my scrollview always react to a horizontal paging
here is a visual of my setup:
tell me if you need any more info
There are multiple ways to get around this.
One way is that you could manage the horizontal scrolling yourself with UIGestureRecognizer. So if there is a left swipe then scroll horizontally to the left and vice versa for right swipe. That way if a UITableViewController is vertically scrolling at the time of the horizontal swipe, it won't have to wait until it is stopped to detect it.

How to enable UIPageViewController's page scroll while scrolling its content vertically (a collection view)?

I'm making an app like SmartNews, with a UIPageViewController that contains many UICollectionView pages.
The structure:
A UIPageViewController, with pages scrolling horizontally. (Transition style is UIPageViewControllerTransitionStyleScroll)
Each page in it contains a UICollectionView scrolling a set of cells vertically.
Both view have the same size and touch areas on the screen are common.
The problem:
While the collection view is scrolling down by itself (i.e. the user is no longer touching the screen but the collection view is still scrolling by decelerating), the user can't swipe pages.
It seems if another pan gesture occurs at this moment, it is tracked by the collection view to stop the current scroll and it doesn't allow the user to swipe the page view controller.
Is there a way to allow the user to scroll pages (horizontally), while the collection view is still scrolling (vertically)?
(Instagram's search view realizes this feature.)
Thanks!
Found what I wanted to do here:
Cross Directional UIScrollViews - Can I Modify the Scrolling Behaviour?
I guess it's unsafe to do the same with UIPageController as the scroll view inside it is undocumented.
I will try to replace the UIPageController with a UISCrollView with paging enabled.

Resources