Skip to content

Commit

Permalink
Adding a subtle crossfade when transitioning NYTScalingImageView be…
Browse files Browse the repository at this point in the history
…tween placeholder and image.

I noticed especially with differing aspect ratios that this was a fairly jarring transition.
  • Loading branch information
benguild committed May 1, 2018
1 parent a518794 commit f095d37
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions NYTPhotoViewer/NYTScalingImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit f095d37

Please sign in to comment.