我想在UICollectionViewLayout
中执行变换动画。好吧,这很容易实现,但我找不到设置anchorPoint
UICollectionViewLayoutAttributes
的方法。我想在插入集合视图项目时执行门打开和关闭动画
-(UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)itemIndexPath{
UICollectionViewLayoutAttributes *attributes = [super initialLayoutAttributesForAppearingItemAtIndexPath:itemIndexPath];
attributes.alpha = 1.0;
CGFloat progress = 0.0;
CATransform3D transform = CATransform3DIdentity;
transform.m34 = -1.0/500.0;
CGFloat angle = (1 - progress) * M_PI_2;
transform = CATransform3DRotate(transform, angle, 0, 1, 0 );
UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:itemIndexPath];
cell.hidden = YES;
attributes.transform3D = transform;
return attributes;
}
答案 0 :(得分:0)
anchorPoint
中似乎没有UICollectionViewLayoutAttributes
属性,因此您必须对其进行子类化,为anchorPoint
添加属性并使用applyLayoutAttributes
在UICollectionViewCell
上设置单元格上的anchorPoint
值。