@@ -831,39 +831,57 @@ - (void)finalizeLayoutTransition
831
831
*/
832
832
- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath : (NSIndexPath *)itemIndexPath
833
833
{
834
- UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath: itemIndexPath].copy ;
835
- attributes.alpha = 0.1 ;
836
- return attributes;
834
+ if (self.elementAppearingAnimationFromValue ) {
835
+ self.elementAppearingAnimationFromValue (itemIndexPath,
836
+ nil ,
837
+ UICollectionElementCategoryCell);
838
+ }
839
+ return [super initialLayoutAttributesForAppearingItemAtIndexPath: itemIndexPath];
837
840
}
838
841
- (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingItemAtIndexPath : (NSIndexPath *)itemIndexPath
839
842
{
840
- UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath: itemIndexPath].copy ;
841
- attributes.alpha = 0.1 ;
842
- return attributes;
843
+ if (self.elementDisappearingAnimationToValue ) {
844
+ self.elementDisappearingAnimationToValue (itemIndexPath,
845
+ nil ,
846
+ UICollectionElementCategoryCell);
847
+ }
848
+ return [super finalLayoutAttributesForDisappearingItemAtIndexPath: itemIndexPath];
843
849
}
844
850
- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingSupplementaryElementOfKind : (NSString *)elementKind atIndexPath : (NSIndexPath *)elementIndexPath
845
851
{
846
- UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForSupplementaryViewOfKind: elementKind atIndexPath: elementIndexPath].copy ;
847
- attributes.alpha = 0.1 ;
848
- return attributes;
852
+ if (self.elementAppearingAnimationFromValue ) {
853
+ self.elementAppearingAnimationFromValue (elementIndexPath,
854
+ elementKind,
855
+ UICollectionElementCategorySupplementaryView);
856
+ }
857
+ return [super initialLayoutAttributesForAppearingSupplementaryElementOfKind: elementKind atIndexPath: elementIndexPath];
849
858
}
850
859
- (nullable UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingSupplementaryElementOfKind : (NSString *)elementKind atIndexPath : (NSIndexPath *)elementIndexPath
851
860
{
852
- UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForSupplementaryViewOfKind: elementKind atIndexPath: elementIndexPath].copy ;
853
- attributes.alpha = 0.1 ;
854
- return attributes;
861
+ if (self.elementDisappearingAnimationToValue ) {
862
+ self.elementDisappearingAnimationToValue (elementIndexPath,
863
+ elementKind,
864
+ UICollectionElementCategorySupplementaryView);
865
+ }
866
+ return [super finalLayoutAttributesForDisappearingSupplementaryElementOfKind: elementKind atIndexPath: elementIndexPath];
855
867
}
856
868
- (nullable UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingDecorationElementOfKind : (NSString *)elementKind atIndexPath : (NSIndexPath *)decorationIndexPath
857
869
{
858
- UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForDecorationViewOfKind: elementKind atIndexPath: decorationIndexPath].copy ;
859
- attributes.alpha = 0.1 ;
860
- return attributes;
870
+ if (self.elementAppearingAnimationFromValue ) {
871
+ self.elementAppearingAnimationFromValue (decorationIndexPath,
872
+ elementKind,
873
+ UICollectionElementCategoryDecorationView);
874
+ }
875
+ return [super initialLayoutAttributesForAppearingDecorationElementOfKind: elementKind atIndexPath: decorationIndexPath];
861
876
}
862
877
- (nullable UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingDecorationElementOfKind : (NSString *)elementKind atIndexPath : (NSIndexPath *)decorationIndexPath
863
878
{
864
- UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForDecorationViewOfKind: elementKind atIndexPath: decorationIndexPath].copy ;
865
- attributes.alpha = 0.1 ;
866
- return attributes;
879
+ if (self.elementDisappearingAnimationToValue ) {
880
+ self.elementDisappearingAnimationToValue (decorationIndexPath,
881
+ elementKind,
882
+ UICollectionElementCategoryDecorationView);
883
+ }
884
+ return [super finalLayoutAttributesForDisappearingDecorationElementOfKind: elementKind atIndexPath: decorationIndexPath];
867
885
}
868
886
869
887
0 commit comments