Comments (6)
Hello @johnCbogil ! Thanks for contributing to this repository by opening this issue!
After the last major update, this library started using a custom layout to position its cells. Since the sizeForItem
function is only defined for the UICollectionViewDelegateFlowLayout
protocol, technically it doesn't exist from this library's perspective.
The reason why this is done this way is because it's not feasible to let the developer change the size of each item manually. The idea of it is for the developer to specify the peeking and it will automatically calculate the cell sizes and display them.
The init
for the behavior has a bunch of attributes you can set to make the library do what you want it to do:
init(cellSpacing: CGFloat = 20, cellPeekWidth: CGFloat = 20, minimumItemsToScroll: Int? = nil, maximumItemsToScroll: Int? = nil, numberOfItemsToShow: Int = 1, scrollDirection: UICollectionView.ScrollDirection = .horizontal, velocityThreshold: CGFloat = 0.2)
You can check the comments in the MSCollectionViewPeekingBehavior
class to have more insights on each variable.
If this is not enough for you to be able to move forward happy to discuss with you here what you need to achieve and if it makes sense to add it to the library I'll work on it
Have a great day!
from mspeekcollectionviewdelegateimplementation.
Ok that makes sense, I appreciate your speedy and thorough response @MaherKSantina!
If I understand you correctly, I should attempt to get my desired itemSize via the behavior's initializer? I only need 1 item size so I think this could work.
Thank you!
from mspeekcollectionviewdelegateimplementation.
As far as I remember you can't get the item size from the library, it calculates it internally and updates the cells to be of that size, so you don't have to worry about you setting it. But do you want the item size to drive something outside the collection view? I'm still a bit confused on why you need the item size 😕
from mspeekcollectionviewdelegateimplementation.
Sorry for the confusion. I understand now that I can't use the itemSize delegate function with the library. That makes sense.
My goal is for my items to be square (equal height and width). I believe that I can configure this via the behavior's initialization parameters.
from mspeekcollectionviewdelegateimplementation.
I have solved my issue by doing a bit of math to determine the necessary cellSpacing to create square items.
Thank you @MaherKSantin !
from mspeekcollectionviewdelegateimplementation.
Hahah I was just writing a comment about how to calculate it using spacing and peeking width 😆 I'm glad you were able to solve it on your own! Thank you so much for contributing and feel free to close this issue if your issue is resolved 👍
Have a wonderful day!
from mspeekcollectionviewdelegateimplementation.
Related Issues (20)
- Scrolling with 0 velocity will not land on the correct page HOT 11
- Add support to animate peeking items while scrolling HOT 1
- Where is MSPeekImplementationDelegate now? HOT 3
- Add SPM Support HOT 2
- Alignment horizontal scroll collection view HOT 6
- Is it possible to change the view content of center one? HOT 3
- RxCollectionView only shows one cell always HOT 1
- Use of undeclared type 'MSCollectionViewPeekingBehavior' HOT 4
- Use of undeclared type 'MSCollectionViewPeekingBehavior' HOT 1
- extra space !? HOT 4
- MSPeekImplementationDelegate returns under/over index in race conditions HOT 5
- Top and Bottom spacing of UICollectionViewCell cut HOT 2
- Crash on behavior.scrollViewWillEndDragging call in v3.1.1
- Collection view item is getting cut off HOT 8
- SPM Fail HOT 1
- Backward scroll
- Scroll bars not visible
- can't change cell size and positioning
- Mistakenly created
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mspeekcollectionviewdelegateimplementation.