I want to add some animation to the imageView with the SDWebImage
.and my collectionView delegate function is here
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
Cell *cell = (Cell *)[cv dequeueReusableCellWithReuseIdentifier:@"identifier" forIndexPath:indexPath];
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:URL] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
cell.imageView.alpha = 0;
[UIView animateWithDuration:0.5 animations:^{
cell.imageView.alpha = 1;
}];
}];
}
It's OK during the SDWebImage download the image and set the image of the imageView.
But when I call the [collection reloadData]
method,these imageViews dissolve again.
I know the reason but I do not have a solution of it.