Vertical and horizontal scrolling collection views in a view - ios

I have a couple horizontal scrolling collection views and one vertical scrolling collection view that are added to the same view. These collection views are overlapping like this.
If you're touching the horizontal scrolling collection view I would still like to be able to scroll the vertical scrolling collection view and vice versa. Is that possible to do?

Related

How to scroll whole screen with multiple collectionview that have different scroll directions

I want to have two collection views that scrolls like this: the goal
I have achieved this but I then have the problem that when I scroll down the green collection view scrolls for alone and not the whole view: collection view with scroll
I then locked the scroll in the green collection view and put a scroll view around the whole screen. But when you scroll the collection view gets cut like this: collectionview locked
I have seen other apps like medium have two collection view that scrolls in two directions but I can not figure out have to achieve this.
Medium home
To make the scroll view able to scroll have I done this to calculate the height of the two collectio views and then setting the heigt to the scrollview:
var size : CGSize
let height = firstView.frame.height +
secondview.collectionViewLayout.collectionViewContentSize.height
size = CGSize(self.view.frame.width,height)
scrollview.contentSize = size
And my guess is that I might want to do the same for the green collection view but I have not got that to work.
Thanks!
Take a UITableView (for vertical scrolling). Put a collection view (with horizontal scrolling) in the header of the table view. By doing this, you would have horizontally scrollable view and the problem of cutting of view would be fixed. Moreover, you will not have to take another view for vertical scrolling. You will achieve that with the cells of table view.
Design like Medium (or many other apps) are easily achievable this way. A table view (vertical scrolling), a collection view (horizontal scrolling) as table view's header, and rest everything would be managed by table view. Give it a try.

UICollectionView inside UIScrollView not scrolling

I have a vertically-scrolling scroll view that has a single subview. This subview has a couple of collection views. I want them to scroll horizontally. It doesn't work because they are inside the scroll view.
The problem is that the pan/scrolling gesture is working just for the scroll view and it doesn't propagate to the collection views. I just see the scroll view scrolling.
There is the same problem with tapping on a collection cell. This event just doesn't happen.
I already tried adding the gestures manually but I am not able to scroll the collection views.
How can I propagate all the gestures ?
Thank you !
]1

UICollectionView cannot scroll while containing UIScrollView decelerates

I've implemented pretty common pattern: you could scroll horizontally between views (paging enabled) and you could scroll any "page" down for more details. It is done with parent UICollectionView containing UIScrollViews, see enclosed image:
Collection View can scroll only horizontally, Scroll View can scroll only vertically.
However I am unable to achieve "proper" horizontal scrolling. I cannot scroll horizontally while inner scroll view is decelerating which heavily decreases UX quality. Tried so far: directionalLockEnabled, delaysContentTouches, canCancelContentTouches, touchesShouldBegin: and gestures with requireGestureRecognizerToFail - all without success (but maybe not all done right).

UIScrollView that has UITableViews as subviews won't scroll horizontally

I have a view controller that owns a UISegmentedControl, a UIScrollView, and several UITableViews. The segmented control and the scroll view are subviews of the view controller's root view. The table views are subviews of the scroll view. The scroll view takes up all the space below the segmented control and each table view is as large as the scroll view. Table views are placed horizontally aligned inside the scroll view.
The view controller should support scrolling to one of its table views either by selection in the segmented control (that works) or by swipe gesture (that does not work yet). I have checked that the scroll view's contentSize is appropriate and I have also tried turning the table view cells' userInteractionEnabled off. I have also checked that the table views do not exceed the size of the scroll view as discussed here. (Each table view is as large as the scroll view, albeit at a horizontal offset.) Still the scroll view can|t be swiped horizontally as I would expect.
Could it be that the table views themselves consume all (including horizontal) swipe gestures as part of their support for vertical scrolling? How can I ensure that the scroll view further up in the scroll hierarchy can (also) react to such swipe gestures?

UIScrollView an Paginator

I thought about the possibilities in UI Design for a new app. What I want to do is:
Have three view where the user can paginate horizontally. In each of this view there is a UIScrollView (fills the whole view) where the user can scroll vertically.
How could I manage, that horizontal scroll events are managed by the Pagination and vertical scrolls are managed by the ScrollView?
I'm sorry, maybe this is kind of a "beginner-Question"...
There might be a possibility to send the different touches to different UI-Elements?
Place the 3 scroll views inside a large scroll view.
The 3 vertical scrolling views should have a content size that matches the screen's width - this will stop them scrolling horizontally and the event will pass up to the the parent scroll view to allow horizontal scrolling.
Ensure that the content size of the parent view matches the screen height so that it only scrolls horizontally.

Resources