gleue / TGLStackedViewController

A stacked view layout with gesture-based reordering using a UICollectionView -- inspired by Passbook and Reminders apps.
MIT License
1.21k stars 117 forks source link

Can I set header and footer in this collection view? #16

Closed WendyLei closed 10 years ago

WendyLei commented 10 years ago

Can I set header and footer in this collection view?

gleue commented 10 years ago

Currently no, but the only thing you'd have to do to use headers and footers is modify the -prepareLayout method to compute layout attributes for them and then have -layoutAttributesForElementsInRect and -layoutAttributesForItemAtIndexPath return them together with the cell's layout attributes.

gleue commented 10 years ago

Sorry, my mistake: not -layoutAttributesForItemAtIndexPath but add method -layoutAttributesForSupplementaryViewOfKind:atIndexPath: to TGL*Layout.

Also you'd need to register a UICollectionReusableView subclass or a UINib for your supplementary view in the view controller and dequeue them as needed in method -collectionView:viewForSupplementaryElementOfKind:atIndexPath: