So in the doc, it says:
minimumInteritemSpacingForSectionAtIndex
: For a horizontally scrolling grid, this value represents the minimum spacing between items in the same column.
minimumLineSpacingForSectionAtIndex
: For a horizontally scrolling grid, this value represents the minimum spacing between successive columns.
What I guess is if the section count is 1, I should use minimumInteritemSpacingForSectionAtIndex
; when section count > 1, I should use minimumLineSpacingForSectionAtIndex
.
However, I have a horizontal scrolling collection view, the section count is 1, and item count is 2.
When I set minimumInteritemSpacingForSectionAtIndex
return 10, it seems nothing happens. When I use minimumLineSpacingForSectionAtIndex
return 10, the left cell and right cell has 10 space margin, seems working.
So I am confused what does same column
and successive columns
meaning here. Could someone explain?
- collectionView:layout:minimumLineSpacingForSectionAtIndex:
Asks the delegate for the spacing between successive rows or columns of a section.
Discussion
If you do not implement this method, the flow layout uses the value in its minimumLineSpacing property to set the space between lines instead. Your implementation of this method can return a fixed value or return different spacing values for each section.
- collectionView:layout:minimumInteritemSpacingForSectionAtIndex:
Asks the delegate for the spacing between successive items in the rows or columns of a section.
Discussion
If you do not implement this method, the flow layout uses the value in its minimumInteritemSpacing property to set the space between items instead. Your implementation of this method can return a fixed value or return different spacing values for each section.
I believe this is well documented and discussed under UICollectionViewDelegateFlowLayout
same row.(for inter item) represents the minimum spacing between items this will determine how many items will be at a single line.
This is for vertical grid:
ex:
[1] (interItemSpacing) [2] (interItemSpacing) [3]
[4] (interItemSpacing) [5] (interItemSpacing) [6]
This is for horizal grid:
ex:
[1] [3] [5]
(interItemSpacing) (interItemSpacing) (interItemSpacing)
[2] [4] [6]
successive row.(for line spacing) represents the minimum spacing between successive rows
This is for vertical grid:
ex:
[1] [2] [3]
(lineSpacing) (lineSpacing) (lineSpacing)
[4] [5] [6]
This is for horizal grid:
ex:
[1] (lineSpacing) [3] (lineSpacing) [5]
[2] (lineSpacing) [4] (lineSpacing) [6]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With