Skip to content
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

Merged
merged 2 commits into from
Jan 25, 2018

Conversation

anayini
Copy link
Contributor

@anayini anayini commented Jan 25, 2018

Changes in this pull request

Add Collection View Supplementary Views

UINib(nibName: "CollectionToolCell", bundle: nil),
forCellWithReuseIdentifier: "CollectionToolCell"
)


collectionView.register(UINib(nibName: "CollectionViewHeaderView", bundle: nil), forCellWithReuseIdentifier: "CollectionViewHeaderView")
flowLayout.headerReferenceSize = CGSize(width: 375, height: 25)
Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

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")
Copy link
Contributor

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: )

Copy link
Contributor

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.

Copy link
Contributor Author

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,
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah all fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

@anayini
Copy link
Contributor Author

anayini commented Jan 25, 2018

@jessesquires - updated

@anayini anayini merged commit 7eb5be5 into master Jan 25, 2018
@jessesquires jessesquires deleted the collection-view-supplementary-views branch February 5, 2018 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants