So my problem is that every time that I'm trying to scroll, scroll view doesn't work. Only the scroll of the collection view is working.
I have my ViewController
and this subviews:
. View
.. Scrollview
... Label
... Image
... Label
... CollectionView (column of 2)
I tried to disable scroll in collection view but nothing is working as expected.
CollectionView defines two ScrollTo methods, that scroll items into view. One of the overloads scrolls the item at the specified index into view, while the other scrolls the specified item into view.
A view that defines the behavior for all cells and supplementary views presented by a collection view.
An object that manages an ordered collection of data items and presents them using customizable layouts.
The scroll view displays its content within the scrollable content region. As the user performs platform-appropriate scroll gestures, the scroll view adjusts what portion of the underlying content is visible. ScrollView can scroll horizontally, vertically, or both, but does not provide zooming functionality.
From the information in the question it's hard to give a detailed answer. Just a little tip. You should carefully check 2 important things, when your are working with UIScrollView
:
contentSize
of your scroll view.Maybe this will help.
There are also some tips even you choose to disable scrollable for uicollectionView:
It's not considered good practice to put an UICollectionView
inside a UIScrollView
because this will result in some unwanted behavior since UICollectionView
is a descendant of the UIScrollView
class.
Instead of having a UIScrollView
with Label, Image, Label, CollectionView
, you could remove the UIScrollView
and add a UICollectionReusableView
as a header to the UICollectionView
. Inside this header you can put the Label, Image, Label
and that view will always stay on top of the UICollectionView
section you created the header for.
You could have a go at this and then come back to us if you run in to some problems :)
UICollectionView
Collection View Basics
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With