MaherKSantina / MSPeekCollectionViewDelegateImplementation

A custom paging behavior that peeks the previous and next items in a collection view
https://medium.com/@maher.santina90/how-to-create-cells-that-peek-on-the-sides-like-ios-11-app-store-ef4bb54c0c7d
MIT License
356 stars 32 forks source link

extra space !? #66

Closed ahmedsafadii closed 4 years ago

ahmedsafadii commented 4 years ago
    behavior = MSCollectionViewPeekingBehavior(cellSpacing: 0)
    behavior = MSCollectionViewPeekingBehavior(cellPeekWidth: 0)
    behavior = MSCollectionViewPeekingBehavior(minimumItemsToScroll: 1)
    behavior = MSCollectionViewPeekingBehavior(maximumItemsToScroll: 1)
    behavior = MSCollectionViewPeekingBehavior(numberOfItemsToShow: 1)
    leagueCollectionView.configureForPeekingBehavior(behavior: behavior)

why this extra space !!?

Simulator Screen Shot - iPhone SE - 2020-05-24 at 15 55 51

cell

Screen Shot 2020-05-24 at 3 56 31 PM
ahmedsafadii commented 4 years ago
    behavior = MSCollectionViewPeekingBehavior(cellPeekWidth: 0)
    behavior = MSCollectionViewPeekingBehavior(minimumItemsToScroll: 1)
    behavior = MSCollectionViewPeekingBehavior(maximumItemsToScroll: 1)
    behavior = MSCollectionViewPeekingBehavior(numberOfItemsToShow: 1)
    print("Dsada", behavior.cellSpacing)
    print("Dsada", behavior.cellPeekWidth)
    leagueCollectionView.configureForPeekingBehavior(behavior: behavior)

it looks like that it prints default value 20 and ignore the value that I set

MaherKSantina commented 4 years ago

Hello @ahmedsafadii , thank you for reaching out and contributing to this repository by opening this issue! I think the README is not very clear concerning this. If you want to pass multiple parameters to the behavior (cellPeekWidth, minimumItemsToScroll, maximumItemsToScroll and numberOfItemsToShow), then you need to use 1 initializer call, not 4 different ones. So you should do this:

behavior = MSCollectionViewPeekingBehavior(cellPeekWidth: 0, minimumItemsToScroll: 1, maximumItemsToScroll: 1, numberOfItemsToShow: 1)

Instead of:

behavior = MSCollectionViewPeekingBehavior(cellPeekWidth: 0)
behavior = MSCollectionViewPeekingBehavior(minimumItemsToScroll: 1)
behavior = MSCollectionViewPeekingBehavior(maximumItemsToScroll: 1)
behavior = MSCollectionViewPeekingBehavior(numberOfItemsToShow: 1)

Please let me know if this helps

ahmedsafadii commented 4 years ago

Yes it works 👍

On Mon, May 25, 2020 at 8:00 AM Maher Santina notifications@github.com wrote:

Hello @ahmedsafadii https://github.com/ahmedsafadii , thank you for reaching out and contributing to this repository by opening this issue! I think the README is not very clear concerning this. If you want to pass multiple parameters to the behavior (cellPeekWidth, minimumItemsToScroll, maximumItemsToScroll and numberOfItemsToShow), then you need to use 1 initializer call, not 4 different ones. So you should do this:

behavior = MSCollectionViewPeekingBehavior(cellPeekWidth: 0, minimumItemsToScroll: 1, maximumItemsToScroll: 1, numberOfItemsToShow: 1)

Instead of:

behavior = MSCollectionViewPeekingBehavior(cellPeekWidth: 0) behavior = MSCollectionViewPeekingBehavior(minimumItemsToScroll: 1) behavior = MSCollectionViewPeekingBehavior(maximumItemsToScroll: 1) behavior = MSCollectionViewPeekingBehavior(numberOfItemsToShow: 1)

Please let me know if this helps

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MaherKSantina/MSPeekCollectionViewDelegateImplementation/issues/66#issuecomment-633376581, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVGVALK5DPJON3Q5ZGPP3TRTH3NJANCNFSM4NI4BXZA .

MaherKSantina commented 4 years ago

Awesome! Have a great day 👍