Skip to content
This repository has been archived by the owner on Oct 11, 2021. It is now read-only.

Expanding a cell taking time #47

Open
tapan-nathvani opened this issue Nov 14, 2017 · 6 comments
Open

Expanding a cell taking time #47

tapan-nathvani opened this issue Nov 14, 2017 · 6 comments

Comments

@tapan-nathvani
Copy link

tapan-nathvani commented Nov 14, 2017

in this method
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:
(NSIndexPath *)indexPath {
if (self.exposedItemIndexPath && indexPath.item == self.exposedItemIndexPath.item) {
self.exposedItemIndexPath = nil;
}
else {
NSLog(@"Hello1");
self.exposedItemIndexPath = indexPath;
NSLog(@"Hello2");
}

when i am assigning exposedItemIndexPath its taking almost 5 to 6 seconds to expand a cell.

Can you please help me to improve this ?

@tapan-nathvani tapan-nathvani changed the title Expanding cell taking time Expanding a cell taking time Nov 14, 2017
@gleue
Copy link
Owner

gleue commented Nov 14, 2017

Having around 100 cards in the sample app makes selecting/deselecting noticeably slower. Recomputing the layout transitions takes its time.

How many cells do you have?

@tapan-nathvani
Copy link
Author

tapan-nathvani commented Nov 15, 2017

I have almost 78 cards and it will increase.

@gleue
Copy link
Owner

gleue commented Nov 15, 2017

Hm, that could be a problem.

When switching layouts UIKit creates animations for all cards from one to the other layout. That would mean 78+ animations in parallel.

Could you try switching layouts w/o animations. Just to get an idea?

@tapan-nathvani
Copy link
Author

Yes i tried by Passing NO to animation.. But it still taking time.

In this method of TGLStackedViewController Class

  • (void)setExposedItemIndexPath:(nullable NSIndexPath *)exposedItemIndexPath {

    [self setExposedItemIndexPath:exposedItemIndexPath animated:NO];
    }

is there any solution to make it fast ?

@gleue
Copy link
Owner

gleue commented Nov 15, 2017

You could use instruments to see where the lag is introduced

@tapan-nathvani
Copy link
Author

OKies. Will check it and let you know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants