consider the insetForSection for estimating size#21
Open
andymedvedev wants to merge 1 commit intoivedeneev:masterfrom
andymedvedev:master
Open
consider the insetForSection for estimating size#21andymedvedev wants to merge 1 commit intoivedeneev:masterfrom andymedvedev:master
andymedvedev wants to merge 1 commit intoivedeneev:masterfrom
andymedvedev:master
Conversation
ivedeneev
reviewed
Sep 9, 2020
|
|
||
| open func sizeForItem(at indexPath: IndexPath, boundingSize: CGSize) -> CGSize { | ||
| return items[indexPath.item].estimatedSize(boundingSize: boundingSize) | ||
| let sizeWithInsets = CGSize(width: boundingSize.width - insetForSection.left - insetForSection.right, |
Owner
There was a problem hiding this comment.
I can't totally agree with this change. For instance, we might not wanna use vertical insets for CollectionView with vertical scrolling. For some cases we need to know exact size of collection view and only use horizontal / vertical section insets for proportions calculation. I made change in 1.0.0 branch where we can respect section insets and spacings in cell size calculation. If u wanna match ur cell width to collectionView width and section insets u should consider use adjustsWidth(true) modifier of CollectionItem
Owner
There was a problem hiding this comment.
see this example https://github.com/ivedeneev/CollectionKit/blob/master/Examples/ViewController.swift line 29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bugs raised when
insetForSectionis specified butboundingSizeatestimatedSize(boundingSize:)is wrong so it leads to incorrect size estimation.