2016-08-20 3 views
0

셀에있는 사람을 누르면 내 애니메이션 ImageView가 숨겨집니다. 버튼은 없으며 사라지지 않아야합니다. 그게 전부 내 코드 :애니메이션 ImageView 콜렉션에서 숨기기 클릭하여 살기

for (int x = 9; x > 0; x = x-1) { 

     NSArray *imageArray = [NSArray arrayWithObjects:[UIImage imageNamed:[NSString stringWithFormat:@"%d-1.png",x]], 
           [UIImage imageNamed:[NSString stringWithFormat:@"%d-2.png",x]], 
           [UIImage imageNamed:[NSString stringWithFormat:@"%d-3.png",x]], 
           [UIImage imageNamed:[NSString stringWithFormat:@"%d-4.png",x]], 
           [UIImage imageNamed:[NSString stringWithFormat:@"%d-3.png",x]], 
           [UIImage imageNamed:[NSString stringWithFormat:@"%d-2.png",x]],nil]; 

     [array addObject:imageArray]; 

    } 


-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 
    return feedArray.count; 
} 

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ 

    NSArray *contentArray = [feedArray objectAtIndex:indexPath.row]; 

    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[NSString stringWithFormat:@"%lu",(unsigned long)contentArray.count] forIndexPath:indexPath]; 

    if (contentArray.count == 1) { 

     UIImageView *firstImageView = (UIImageView *)[cell viewWithTag:1]; 
     firstImageView.contentMode = UIViewContentModeScaleAspectFill; 
     firstImageView.animationImages = [contentArray objectAtIndex:0]; 
     firstImageView.animationDuration = 1.2; 
     [firstImageView startAnimating]; 

    } 
    return cell; 

} 

나를 도울 수있는 누군가?

대단히 감사합니다!

+0

- collectionView : didSelectItemAtIndexPath 메서드가있는 경우 코드가 있습니까? 그렇다면 게시 할 수 있습니다. – JingJingTao

+0

아니요. – Peter

답변