Using the code below I have successfully made my UIImageView fade in its image.
[UIView transitionWithView:myCell.myImageView duration:2.0 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
myCell.myImageView.image = myImage;
} completion:NULL];
However, when the cell is reused I need to remove this image. When reused it shows the last image(shown before it was reused) and then transitions into the image it is supposed to be, instead of transitioning from no image into the image it is supposed to be.
What I have tried:
-(void)prepareForReuse {
[super prepareForReuse];
// More is obviously needed than just setting image to nil when using a transition
self.myImageView.image = nil;
[self.myImageView setNeedsDisplay];
// but I also tried removing all animations
[self.myImageView.layer removeAllAnimations];
// and I even tried removing the sublayers, but still no success.
[self.myImageView.layer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)];
}
Any help is appreciated, but please don't answer if you don't understand what the issue is. Comment instead so I can explain better if needed.
Thanks!
Thank you for trying, but none of the answers fixes the problem. I have also tried combinations of the different answers. Also, none of them satisfy "Looking for an answer drawing from credible and/or official sources.". I have contacted Apple Developer Technical Support and will edit this answer when I get a response from them so that it will help others as well.