CollectionViewShelfLayout icon indicating copy to clipboard operation
CollectionViewShelfLayout copied to clipboard

Add disclose indicator

Open cukingpro opened this issue 5 years ago • 11 comments

Hi, Can we add disclose indicator for a section like tableView cell?

cukingpro avatar Aug 07 '19 07:08 cukingpro

Yes, you can. By having a custom subclass for the Header view for each section

pitiphong-p avatar Aug 07 '19 08:08 pitiphong-p

But the header is on top. Can I put it to the right like this? Screen Shot 2019-08-07 at 3 12 09 PM

cukingpro avatar Aug 07 '19 08:08 cukingpro

What are those square? Are they a UICollectionViewCell?

pitiphong-p avatar Aug 07 '19 08:08 pitiphong-p

Yes. Those are cells of that section.

cukingpro avatar Aug 07 '19 08:08 cukingpro

I think in this case, you can have a disclosure indicator a UICollectionViewCell with another cell type with its own cell identifier and return it from the cellForItem method.

pitiphong-p avatar Aug 07 '19 08:08 pitiphong-p

That will make it scrollable. I want it to stay at the right.

cukingpro avatar Aug 07 '19 08:08 cukingpro

Screen Shot 2019-08-07 at 3 28 12 PM This is the design.

cukingpro avatar Aug 07 '19 08:08 cukingpro

I see. I'm afraid that this library doesn't support this scenario out of the box but you can fork this project and make a change to make it support your scenario

pitiphong-p avatar Aug 07 '19 08:08 pitiphong-p

Thank you for your work. Do you have any suggestion for that?

cukingpro avatar Aug 07 '19 08:08 cukingpro

You can add a new kind of supplementary view for the detail disclosure (and may also with a custom Layout Attribute) and layout it in prepareLayout method similar to https://github.com/pitiphong-p/CollectionViewShelfLayout/blob/master/CollectionViewShelfLayout/CollectionViewShelfLayout.swift#L178-L186 and also return in the layoutAttributesForElements(in:) and layoutAttributesForSupplementaryView(ofKind:at:) methods

pitiphong-p avatar Aug 07 '19 08:08 pitiphong-p

Or if you set the deployment target at iOS 13 then you may try the new https://developer.apple.com/documentation/uikit/uicollectionviewcompositionallayout as presented in https://developer.apple.com/videos/play/wwdc2019/215/

pitiphong-p avatar Aug 07 '19 09:08 pitiphong-p