SwiftKickMobile / TLLayoutTransitioning

Enhanced transitioning between UICollectionView layouts in iOS.
MIT License
355 stars 47 forks source link

Add support for headers and footers #9

Closed geoffnix closed 9 years ago

geoffnix commented 10 years ago

This project is awesome and saved me a lot of time. One thing missing was support for layouts with headers and footers. Here's what I changed to support my app.

wtmoose commented 10 years ago

Geoff,

I’m glad you found this useful and I appreciate the contribution.

But…

I actually added support for supplementary views last week! See https://github.com/wtmoose/TLLayoutTransitioning/issues/8

If you haven’t already done so, check out the new features in version 1.0.0:

Changes in 1.0.0

I will take a look through your implementation to see if there is anything I can merge in.

One improvement I want to make is to have the transition layout automatically determine the supplementary view kinds (in my implementation, you have to provide a list to the constructor).

Best,

Tim

On Apr 22, 2014, at 2:12 PM, geoffnix notifications@github.com wrote:

This project is awesome and saved me a lot of time. One thing missing was support for layouts with headers and footers. Here's what I changed to support my app.

You can merge this Pull Request by running

git pull https://github.com/modcloth/TLLayoutTransitioning header_support Or view, comment on, or merge it at:

https://github.com/wtmoose/TLLayoutTransitioning/pull/9

Commit Summary

Add support for headers and footers File Changes

M TLLayoutTransitioning/TLTransitionLayout.m (46) Patch Links:

https://github.com/wtmoose/TLLayoutTransitioning/pull/9.patch https://github.com/wtmoose/TLLayoutTransitioning/pull/9.diff — Reply to this email directly or view it on GitHub.

geoffnix commented 10 years ago

Awesome thanks - I forked just a few days too early, I think.

FWIW, I couldn't find a way to automatically determine what supplementary views are in use. For headers and footers you can call "layoutAttributesForSupplementaryViewOfKind:atIndex" for headers and footers for each section - and ignore nil responses. But I could find no way to get other decoration views.

Good luck, and thanks again for a great project.

wtmoose commented 10 years ago

FWIW, I couldn't find a way to automatically determine what supplementary views are in use.

Yeah I was thinking about that. UICollectionViewLayoutAttributes has a representedElementKind property. So I think if you call layoutAttributesForElementsInRect: with a big enough rect to get everything, you can get the list of kinds by inspecting representedElementKinds. There's also representedElementCategory property, so you know the element type.