TGLStackedViewController
TGLStackedViewController copied to clipboard
Expanding a cell taking time
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 ?
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?
I have almost 78 cards and it will increase.
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?
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 ?
You could use instruments to see where the lag is introduced
OKies. Will check it and let you know.