2013-07-18 2 views
4

저는 uicollectionview가있는 뷰 컨트롤러를 제시합니다. 세포가 맨 위에서 움직이기를 원합니다.UICollectionView는 처음에 셀을 애니메이션합니다.

내 레이아웃은 FlowLayout에의 sublclass, 그래서이 방법 오버라이드 (override) :. 그들은에서 애니메이션 전에 화면에 잠시

- (UICollectionViewLayoutAttributes *) initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)indexPath { 
    UICollectionViewLayoutAttributes* attributes = [super initialLayoutAttributesForAppearingItemAtIndexPath:indexPath]; 
    CGFloat height = [self collectionViewContentSize].height; 
    attributes.transform3D = CATransform3DMakeTranslation(0, -height, 0); 
    return attributes; 
} 

그것은 거의 작동하지만 난 세포 (플래시)를 나타 참조

변형이 적용되기 전에 최종 위치에 나타나는 이유는 무엇이며 어떻게 방지 할 수 있습니까?

답변

0

오히려 설정보다 중앙 변경, 변환 : 변경

- (UICollectionViewLayoutAttributes *) initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)indexPath { 
    UICollectionViewLayoutAttributes* attributes = [super initialLayoutAttributesForAppearingItemAtIndexPath:indexPath]; 
    CGPoint c = attributes.center; 
    c.y -= self.collectionViewContentSize.height; 
    attributes.center = c; 
    return attributes; 
} 

을하고이 때문에 frame 속성을 무효화하기 때문에 항상 가시성을 결정하는 문제가 발생할 수 있습니다 변환.

관련 문제