
If you add more nested CollectionView's to Nested Adapter example, you will notice that the horizontal scroll will be broken. Pod installed from master branch (https://github.com/Instagram/IGListKit).
Thanks @shuhrat10 ! 馃槃 Can you provide more info or a link to the modified demo project?
cc @rnystrom
Just replace data array in NestedAdapterViewController.swift file.
let data = [
"Ridiculus Elit Tellus Purus Aenean",
"Condimentum Sollicitudin Adipiscing",
14,
"Ligula Ipsum Tristique Parturient Euismod",
"Purus Dapibus Vulputate",
6,
"Tellus Nibh Ipsum Inceptos",
2,
43,
15,
20,
15,
"a",
"c",
4
] as [Any]
Then run project and scroll a little to the left of the first collectionview and then scroll down.
Tested on iPhone 7+ (iOS 10) and didn't do it, but tried on the same device as the screenshot iPhone 5s (iOS 9.3) and it does it (using the modified data type) presumably relating to the screen size as it determines how much loads ahead of being shown
Looks to me like a simple case of when a UICollectionViewCell is reused then the scrollview is not reset. Adding in a prepareForReuse fixes this, PR open.
@Sherlouk The fixes looks good until you do not need to keep contentOffset for previous collectionview. I think we need to store contentOffset in OrderedSet for existing collectionview, and pass this value to prepareForReuse if it exist.
@shuhrat10 I already mentioned that in the PR, but not sure how deep we want to get with functionality based on what the example is trying to show (being that you can nest collection views)
Happy to leave this discussion open, and if we want to store offsets then that's a simple addition!
Will be great if IGListKit will store offsets out-of-box. @Sherlouk cc @rnystrom
@shuhrat nice find! I think this also reinforces that we need to provide a stock embedded collection view section controller like we proposed in #31.
I don't think we can do automatic content offset adjustments because that would require view diving to find a scroll view.
Looks like we can close this and follow-up in #31?
cc: @rnystrom
Most helpful comment
Tested on iPhone 7+ (iOS 10) and didn't do it, but tried on the same device as the screenshot iPhone 5s (iOS 9.3) and it does it (using the modified data type) presumably relating to the screen size as it determines how much loads ahead of being shown
Looks to me like a simple case of when a UICollectionViewCell is reused then the scrollview is not reset. Adding in a
prepareForReusefixes this, PR open.