Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed animation

  • Loading branch information...
commit aa5d63203b2dfe0696b38a89a89fdd29a6fef263 1 parent ea04745
ettore authored

Showing 1 changed file with 5 additions and 10 deletions. Show diff stats Hide diff stats

  1. +5 10 CLCGCell.m
15 CLCGCell.m
@@ -179,24 +179,19 @@ -(void)hideImage
179 179
180 180 -(void)showImage:(UIImage*)img
181 181 {
182   - // once the img view has been layed out once, no need to re-lay it out again
183   - if ([[self imageView] image] == nil)
184   - [self setNeedsLayout]; //layout will happen in next update cycle
185   -
186   - [[self imageView] setImage:img];
187   -
188 182 CALayer *layer = [[self imageView] layer];
189 183
190   - // smooth out the appearance of the image a bit but only if we are changing
191   - // the image content. No need to animate if the image is the same.
192   - if ([[self imageView] image] != img) {
  184 + if ([[self imageView] image] == nil) {
  185 + // once the img view has been layed out once, no need to re-lay it out again
  186 + [self setNeedsLayout]; //layout will happen in next update cycle
193 187 CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"opacity"];
194   - [anim setDuration:0.2]; //0.2 sec
  188 + [anim setDuration:0.3]; // seconds
195 189 [anim setFromValue:[NSNumber numberWithFloat:0.0]];
196 190 [anim setToValue:[NSNumber numberWithFloat:1.0]];
197 191 [layer addAnimation:anim forKey:@"animateOpacity"];
198 192 }
199 193
  194 + [[self imageView] setImage:img];
200 195 [layer setOpacity:1.0]; //makes the animation ending value stick
201 196 }
202 197

0 comments on commit aa5d632

Please sign in to comment.
Something went wrong with that request. Please try again.