1
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    OfferCell *cell = (OfferCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];

    cell.lOffer.alpha = 1;

    [UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{
       cell.lOffer.alpha = 0;
    } completion:nil];
}

Now this gives my label (_lOffer) a blinking effect and this label is placed in a collection view cell.

This code works well on the run. But when I tap on the cell and move to next page and come back again, blinking effect doesn't happen. Where can I write that blinking code so that every time the label is blinking even if I move back and forth?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Mukie
  • 129
  • 1
  • 2
  • 9

2 Answers2

1

The answer i found was to reload the collection view in viewWillAppear.

-(void)viewWillAppear:(BOOL)animated{

   [collectionView reloadData];

}
Mukie
  • 129
  • 1
  • 2
  • 9
0

Seems your datasource populating in viewDidload, try it in viewwillappear and reload your collection view. viewwillappear only will call while coming back.

karthikeyan
  • 3,821
  • 3
  • 22
  • 45