Open jannemecek opened 3 years ago
Hi! Thanks for reaching out.
Feel free to fork it and add the functionality - as you've noted there's no public API for that as of right now. I would say a good place to add it is as a property on JEKScrollViewConfiguration
, something like BOOL resetsContentOffsetWhenAppearing
. Then you can check that property here and set the offset to 0 if it is YES
. This allows you to add it to the public API without changing any interfaces, by either setting the default configuration or returning a custom one per section.
I'd appreciate a PR if you add it 😊
@jannemecek Actually, I'm sorry. It is supported, if you use - (void)setHorizontalOffset:(CGFloat)offset forSectionAtIndex:(NSUInteger)index animated:(BOOL)animated;
on the layout object itself. You can do this jus before a section is appearing!
I don't see this method. Is this in the latest release?
I see it mentioned in https://github.com/joelekstrom/JEKScrollableSectionCollectionViewLayout/pull/18 but that hasn't been merged yet @joelekstrom
Oh right. I looked at local checkout of that. Sorry! But yeah, adding that one should solve it. It should be enough to copy L285-305 of that PR and expose it in the header I think.
We're currently looking to add functionality that restores the offset of each section to 0 after a section disappears from screen. Is there a preferred way you imagined for handling this while designing the library or is this something considered to be out of scope? As far as I can see, there's no way to do this with the public API of the library.
I'll fork the library and add the necessary functionality but I was wondering if there's any interest in adding this? If so, I could package a PR for you to check out.