Open whereiswhere opened 4 years ago
Thanks @whereiswhere for raising this issue! I'm interested to know how would you expect the collection view to behave if it has sections? Should the space between sections be the same as regular cells? If that's the case then what is the added value to having sections?
Thanks @whereiswhere for raising this issue! I'm interested to know how would you expect the collection view to behave if it has sections? Should the space between sections be the same as regular cells? If that's the case then what is the added value to having sections?
Yeah, I wish space between sections be the same as regular cells.
my collection view has three types of cells, several cells with videos, one cell with a label, several cells with images, and this collection view resides in a table view cell.
I was using this pod with one section and it works fine. It just recently I found out that it's a bit lag when table view scroll to the position of showing collection view. After looking I couldn't find where the problem is, so I try to use three sections to replace only using one section to see, and it seems resolved the lag, but space between sections are larger than between cells.
But I'm not sure it's the problem as the lag is very subtle and I have to scroll very slowly to detect it. Right now the scrolling looks fine with multiple sections.
@whereiswhere appreciate the detailed explanation! Honestly supporting multiple sections is not part of the scope of this pod. That being said, I'll definitely take a look and see how we can support different sections. Hopefully, it might be like a 1 line change that will help you with your issue and enhance the pod! I'll investigate and get back to you
Hey @whereiswhere, I did some investigation concerning your issue and it looks like there's no easy way to do it. I'd have to restructure some things to make it happen or even create a custom collection view layout. So the problem is that I'm setting the left and right sectionInsets
to make the cell be positioned in the middle. But since we have multiple sections, those insets are being added twice for the sections in the middle, hence causing a double space
So the easier/dirtier way to fix this is to ask the delegate for the number of sections and number of items per section to fix the section insets which I don't like to do because then the delegate would have information about the model. Anyways I'll figure something out. In the meantime feel free to try something out if you have the time! 👍
@MaherKSantina Thanks a lot! Very appreciated that, the problem is a little bit annoying, but it's very subtle so it doesn't bother when normal use.
@whereiswhere no worries mate! yeah I can understand the annoyance when the experience is not 100% smooth. I also need to move to a custom collection view layout anyways so I'll try to do it eventually in my free time. Have a great day!
Hello @whereiswhere ! I just wanted to let you know that I completely re-developed the library with a custom collection view layout! I'm not 100% sure if the new implementation will fix your issue but do you mind taking a look and trying it for me?
Much appreciated buddy ❤️
Hello @whereiswhere ! I just wanted to let you know that I completely re-developed the library with a custom collection view layout! I'm not 100% sure if the new implementation will fix your issue but do you mind taking a look and trying it for me?
Much appreciated buddy ❤️
Hi! Thanks so much for still trying to resolve my problem even your library works pretty great in my app if not perfect.
So I was using the updated library yesterday, and it seems the problem I've met is still there, and there's a new problem...
It's that happed with the collectionView.scrollToItem(at indexPath: IndexPath, at scrollPosition: UICollectionView.ScrollPosition, animated: Bool)
code when the CollectionViewCell first loaded in View.
Like I said, I have some cells for videos, a cell for a Label, and some cells for Images, all wrapped inside a TableViewCell, and when the TableViewCell first loaded, the collectionView will scroll to this index position where the Label cell resided. So a user first see some text, and scroll left, could see some videos, and scroll right to see some image, sort of like that. And when scroll to some position where a video cell or image cell at , there's also a button to scroll back to the label cell.
The problem I met with the updated library is, every time after the collectionView.scrollToTime
run, then swipe the cells in collectionView, it seems jump to a random index position of the collectionView, but if I commented out the collectionView.scrollToItem
, there's no such problem, I try with your example code, and it seems has the same problem.
But amazingly also I find that the lag I've met at the first place could be resolved even by with only one section, is that also comment out the collectionView.scrollToItem
code, so I think this maybe the problem? I'm not sure.
Also, I find that the multi-sections seems doesn't work anymore in the 3.0 version of the library? and when I print out collectionView.numberOfSections
in collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
, it shows the error said "Thread 1: EXC_BAD_ACCESS (code=2, address=0x16f6d7f70)". Don't know if it's a bug or something.
Other functions works pretty well, thanks for the improvement.
Hello @whereiswhere, thank you so much for the effort in writing this detailed explanation!
As for the scrolling issue, you're right it's not working properly, but it seems that it's expected since the items have different frames because of the custom layout. (https://stackoverflow.com/questions/53770783/how-to-use-scrolltoitemat-when-using-a-custom-collectionview-layout-to-alter)
So I created now special function for the behavior to scroll to the correct index. You can do something like:
behavior.scrollToItem(at: 1, animated: true)
It's now in v 3.0.1 and available in the Readme under Features
section
As for the multiple sections, I totally missed that 😢 I was focused on just making it work for 1 section and forgot to support multiple ones. It's just a bit complicated to get the items and then get the indices for multiple sections. But I will try to action it as soon as possible
Again I appreciate your help in making this library better! Always looking for proactive people like you to help me out with this!
Hi, @MaherKSantina, Thanks for the quick reply!
I think it's because of custom layout cause I didn't met this issue from the 2.0 version of the library. And I tried this behavior.scrollToItem(at: 1, animated: true)
, but sadly, it's seems still doesn't work. 🤔
I thought maybe it's because my app's configuration of CollectionViewCell is uncommon, so I added a button to the example code to test it, and look like it has the scrolling issue too. Don't know what's wrong...
Hello @whereiswhere , I'm sorry you're experiencing this issue, I'll investigate it now and see how it goes
Hello @whereiswhere , there was a small bug in the paging behavior which I fixed in the new version (3.0.3), I'll paste below a video of how it's behaving:
Please give it a try and let me know if you're still experiencing any issues
Have a great day!
Hi, I'm so sorry for the late reply! really really busy recently.
The new version works almost perfect on my app right now, the lag of scrolling as I mentions is seems gone, and I found out that it's not your library's problem, the cause is in other part of my code, but don't know why I resolve it too by use multi-sections before .
By the way my app is on App Store and it's free right now, you could download it to see the configuration of my collection view: https://apps.apple.com/us/app/icarus-for-movie-lovers/id1482723043
Really appreciate the support and update for my problems, it really helped me, thanks a lot!
Hello @whereiswhere!
No worries mate all good! Busy is good!
It's great to hear that your issue is fixed!
I've checked out your app, it's looking great! Neat and modern design! And it was great seeing my library in action! It's nice how you added images, videos and text in it
Don't mention it you're welcome! Thanks for having interest and contributing to this repository! If you experience any more issues please let me know
BTW, I had this weird issue on the app store for your app 😆 I'll post a screenshot
Apparently, if you go inside the app's page you can get the app for free, but if you click from the list you have to pay 5$ 😆 I'm assuming your app was paid and then it became free? Looks like Apple have bugs too 🤔
Have a wonderful day!
@MaherKSantina Thanks for noticing that! it's maybe a bug, I think nobody's gonna spend 5 dollars to buy a app for tracking movies...
Anyway you can see I don't add the licenses of the libraries (including yours) to the app yet, kind of busy is the excuse, I'll add it the next update.
@whereiswhere yeah people just like to go with the free app, and it looks like freemium is the trend.
Haha no worries! This library is open source and is meant to help developers build nice features!
Have a great day!
Works fine with one section in collection view, but I don't know if it could with multiple sections? I find that it has larger space between sections than cells. and could be problem with scrolling.