-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Example] Add Collection View Supplementary Views #63
Conversation
UINib(nibName: "CollectionToolCell", bundle: nil), | ||
forCellWithReuseIdentifier: "CollectionToolCell" | ||
) | ||
|
||
|
||
collectionView.register(UINib(nibName: "CollectionViewHeaderView", bundle: nil), forCellWithReuseIdentifier: "CollectionViewHeaderView") | ||
flowLayout.headerReferenceSize = CGSize(width: 375, height: 25) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jessesquires - Note it seems that in order to have the supplementary view delegate calls called I had to explicitly set the flowLayout
's headerReferenceSize
. We probably want to ensure that a user doesn't have to do this somehow. This bug also could have been introduced maybe due to the refactoring happening in the Collection View types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was always a problem I think. Related: #49
You either set this property, or implement FlowLayoutDelegate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opened #65
UINib(nibName: "CollectionToolCell", bundle: nil), | ||
forCellWithReuseIdentifier: "CollectionToolCell" | ||
) | ||
|
||
|
||
collectionView.register(UINib(nibName: "CollectionViewHeaderView", bundle: nil), forCellWithReuseIdentifier: "CollectionViewHeaderView") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't a cell. it's a supplementary view.
you need collectionView.register(, forSupplementaryViewOfKind:, withReuseIdentifier: )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wait. actually no, you shouldn't have to register explicitly. this can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh true
diffingKey: group.name | ||
let headerViewModel = CollectionViewHeaderModel( | ||
title: group.name, | ||
height: nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't this fix your header size problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes - let me try that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah all fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
@jessesquires - updated |
Changes in this pull request
Add Collection View Supplementary Views