2016-08-20 3 views
0

Мой анимированный ImageView скрывается, если я нажимаю его в ячейке. Но нет кнопки, и она не должна исчезать. Вот мой код:Анимированное изображениеView hide in Collection View, нажав

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

ответ

Смежные вопросы