-
-
Notifications
You must be signed in to change notification settings - Fork 57
Implement delegate methods for header/footer reference size #121
Conversation
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.
I think this looks great, just had some questions about zIndex
.
Perhaps we already have that issue now, I just saw it 😄
) | ||
layoutAttribute.size = resolveSizeForSupplementaryView(ofKind: .header, at: sectionIndexPath) | ||
layoutAttribute.zIndex = numberOfSections |
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.
@christoff-1992 Shouldn't we use section
instead of setting the same zIndex
for all attributes?
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.
We should just change it to section
, then it would be incremental?
) | ||
layoutAttribute.size = resolveSizeForSupplementaryView(ofKind: .footer, at: sectionIndexPath) | ||
layoutAttribute.zIndex = numberOfSections |
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.
Same question here as the previous comments.
width = headerReferenceSize.width | ||
} else { | ||
width = collectionView?.documentRect.width ?? headerReferenceSize.width | ||
} |
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.
Should you also be able to provide a width using the delegate or do you reckon that height
would be enough?
Don't know how useful it would be to provide a width, what are your thoughts @christoff-1992
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.
Hmm that's a good point, I don't know why you would have it anything other than the collection view's width but it's one of the options for the delegate methods since you provide the size. 🤷♂️
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.
Perhaps the delegate should take precedence here if it exists. What do you think?
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.
Hmmm.. true but if the size is 0 it's not going to be visible hence why I took the collection views width before.
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.
But wouldn't you expect it to be zero if you delegate method returns zero?
I think it would be more frustrating if you try and set the width and you don't get the expected result.
Ahh regarding the zIndex take a look.. it will make the cells scroll over the section, I think we need to offset this as it starts at 0. |
@zenangst - Although even without the zIndex changes have you seen the example project.. take a look at the footers, there a bit funky.. with sticking to the bottom. Do you think this is the invalidation context? |
@christoff-1992 I pushed some changes to the branch, I think I figured out what was going wrong. Mind taking it for a spin? 😄 |
Looking good :D |
@christoff-1992 good job mate! |
This implements the delegate methods for header/footer reference sizes so they can be provided just like we do for the items.
This will allow users to provide dynamic heights for headers and footers if they wish.