TGLStackedViewController icon indicating copy to clipboard operation
TGLStackedViewController copied to clipboard

Expanding a cell taking time

Open tapan-nathvani opened this issue 7 years ago • 6 comments

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 avatar Nov 14 '17 07:11 tapan-nathvani

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?

gleue avatar Nov 14 '17 11:11 gleue

I have almost 78 cards and it will increase.

tapan-nathvani avatar Nov 15 '17 04:11 tapan-nathvani

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?

gleue avatar Nov 15 '17 11:11 gleue

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 ?

tapan-nathvani avatar Nov 15 '17 11:11 tapan-nathvani

You could use instruments to see where the lag is introduced

gleue avatar Nov 15 '17 11:11 gleue

OKies. Will check it and let you know.

tapan-nathvani avatar Nov 15 '17 11:11 tapan-nathvani