diff --git a/CHANGELOG.md b/CHANGELOG.md index 17bf98fc..2f745210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Changes for users of the library currently on `develop`: - A data source no longer has to handle out-of-bounds indexes ([#227](https://github.com/NYTimes/NYTPhotoViewer/pull/227)) - The data source is not retained ([#227](https://github.com/NYTimes/NYTPhotoViewer/pull/227)) - Respect safe areas for iOS 11 support +- Adding a subtle crossfade when transitioning `NYTScalingImageView` between placeholder and image. ## [1.2.0](https://github.com/NYTimes/NYTPhotoViewer/releases/tag/1.2.0) diff --git a/NYTPhotoViewer/NYTScalingImageView.m b/NYTPhotoViewer/NYTScalingImageView.m index 596d089c..7d39a544 100644 --- a/NYTPhotoViewer/NYTScalingImageView.m +++ b/NYTPhotoViewer/NYTScalingImageView.m @@ -118,8 +118,11 @@ - (void)updateImage:(UIImage *)image imageData:(NSData *)imageData { // Remove any transform currently applied by the scroll view zooming. self.imageView.transform = CGAffineTransformIdentity; - self.imageView.image = imageToUse; - + + [UIView transitionWithView:self /* .imageView */ duration:0.15f options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ + self.imageView.image = imageToUse; + } completion:nil]; + #ifdef ANIMATED_GIF_SUPPORT // It's necessarry to first assign the UIImage so calulations for layout go right (see above) self.imageView.animatedImage = [[FLAnimatedImage alloc] initWithAnimatedGIFData:imageData];