SwiftKickMobile / TLLayoutTransitioning

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

layout transition for supplementary views #8

Closed franklixuefei closed 10 years ago

franklixuefei commented 10 years ago

Hi Tim,

I'm currently making use of your TLLayoutTransitioning class and it is really easy to use! Thanks a lot for developing this! Actually, I encountered a problem with transition with supplementary views. In my project, instead of only one section, I have two sections in the collection view, and for each section, there is a header view and a footer view. However, after applying your resizing example, the header view and footer view are gone after doing a layout transition (animate cells to be bigger.) I don't think this is an issue with your implementation, but I just have no idea how to accommodate supplementary views in your example (Maybe there is a way to fix it easily which I'm not aware of.). So, if at all possible, could you also add some header view/footer view in your resizing example so that I can study from it? I'm in desperate need of a way to make my project work...

Thanks a lot in advance!

Sincerely,

Frank

wtmoose commented 10 years ago

Good suggestion. I'm adding support for supplementary views and it should be posted shortly (assuming it works).

franklixuefei commented 10 years ago

Cool that'll be perfect!

Thanks!

On Apr 18, 2014, at 12:18 PM, wtmoose notifications@github.com wrote:

Good suggestion. I'm adding support for supplementary views and it should be posted shortly (assuming it works).

— Reply to this email directly or view it on GitHub.

wtmoose commented 10 years ago

Fortunately, I have the day off and I was planning to work on my OSS projects :)

I'll be updating docs and publishing a new podspec shortly, but the support for supplementary views has been added and included in the Resize sample project (enable the "show header views" switch).

To support supplementary views, simply provide a list of supplementary view kinds to the TLTransitionLayout initializer:

- (UICollectionViewTransitionLayout *)collectionView:(UICollectionView *)collectionView transitionLayoutForOldLayout:(UICollectionViewLayout *)fromLayout newLayout:(UICollectionViewLayout *)toLayout
{
    NSArray *supplementaryKinds = @[UICollectionElementKindSectionHeader];
    TLTransitionLayout *layout = [[TLTransitionLayout alloc] initWithCurrentLayout:fromLayout nextLayout:toLayout supplementaryKinds:supplementaryKinds];
    return layout;
}

Re-open the ticket if it doesn't work for you.

franklixuefei commented 10 years ago

I just tried it out and it works perfectly!

On Apr 18, 2014, at 2:08 PM, wtmoose notifications@github.com wrote:

Fortunately, I have the day off and I was planning to work on my OSS projects :)

I'll be updating docs and publishing a new podspec shortly, but the support for supplementary views has been added and included in the Resize sample project (enable the "show header views" switch).

To support supplementary views, simply provide a list of supplementary view kinds to the TLTransitionLayout initializer:

  • (UICollectionViewTransitionLayout )collectionView:(UICollectionView )collectionView transitionLayoutForOldLayout:(UICollectionViewLayout )fromLayout newLayout:(UICollectionViewLayout )toLayout { NSArray supplementaryKinds = @[UICollectionElementKindSectionHeader]; TLTransitionLayout layout = [[TLTransitionLayout alloc] initWithCurrentLayout:fromLayout nextLayout:toLayout supplementaryKinds:supplementaryKinds]; return layout; } Re-open the ticket if it doesn't work for you.

— Reply to this email directly or view it on GitHub.

wtmoose commented 10 years ago

Great! Good luck on your project.

Tim

On Apr 18, 2014, at 10:38 PM, Xuefei Li notifications@github.com wrote:

I just tried it out and it works perfectly!

On Apr 18, 2014, at 2:08 PM, wtmoose notifications@github.com wrote:

Fortunately, I have the day off and I was planning to work on my OSS projects :)

I'll be updating docs and publishing a new podspec shortly, but the support for supplementary views has been added and included in the Resize sample project (enable the "show header views" switch).

To support supplementary views, simply provide a list of supplementary view kinds to the TLTransitionLayout initializer:

  • (UICollectionViewTransitionLayout )collectionView:(UICollectionView )collectionView transitionLayoutForOldLayout:(UICollectionViewLayout )fromLayout newLayout:(UICollectionViewLayout )toLayout { NSArray supplementaryKinds = @[UICollectionElementKindSectionHeader]; TLTransitionLayout layout = [[TLTransitionLayout alloc] initWithCurrentLayout:fromLayout nextLayout:toLayout supplementaryKinds:supplementaryKinds]; return layout; } Re-open the ticket if it doesn't work for you.

— Reply to this email directly or view it on GitHub. — Reply to this email directly or view it on GitHub.