Vishal-Singh-Panwar / InfiniteScrolling

Add infinite scrolling to collection view.
MIT License
215 stars 38 forks source link

Cell size (height + width) #7

Open own2pwn opened 6 years ago

own2pwn commented 6 years ago

Is it possible to manually set cell size? i.e. full CGSize not only one param?

Vishal-Singh-Panwar commented 6 years ago

Hi,

Can you update your pod and try using below delegate methods to configure height in case of horizontal scrolling or width in case of vertical scrolling:

func verticalPaddingForHorizontalInfiniteScrollingBehaviour(behaviour: InfiniteScrollingBehaviour) -> CGFloat
func horizonalPaddingForHorizontalInfiniteScrollingBehaviour(behaviour: InfiniteScrollingBehaviour) -> CGFloat

One of the above delegate methods will be called depending on your scroll direction. The reason to avoid passing CGSize is that, wanted to make sure that the cell size to be enough so collectionView show items in a single line. Otherwise, collectionView might show multiple lines if the size is too small.

delox commented 6 years ago

@Vishal-Singh-Panwar Do have any insight on the best approach to support multiple variable widths?