Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed animation

  • Loading branch information...
commit aa5d63203b2dfe0696b38a89a89fdd29a6fef263 1 parent ea04745
@ettore authored
Showing with 5 additions and 10 deletions.
  1. +5 −10 CLCGCell.m
View
15 CLCGCell.m
@@ -179,24 +179,19 @@ -(void)hideImage
-(void)showImage:(UIImage*)img
{
- // once the img view has been layed out once, no need to re-lay it out again
- if ([[self imageView] image] == nil)
- [self setNeedsLayout]; //layout will happen in next update cycle
-
- [[self imageView] setImage:img];
-
CALayer *layer = [[self imageView] layer];
- // smooth out the appearance of the image a bit but only if we are changing
- // the image content. No need to animate if the image is the same.
- if ([[self imageView] image] != img) {
+ if ([[self imageView] image] == nil) {
+ // once the img view has been layed out once, no need to re-lay it out again
+ [self setNeedsLayout]; //layout will happen in next update cycle
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"opacity"];
- [anim setDuration:0.2]; //0.2 sec
+ [anim setDuration:0.3]; // seconds
[anim setFromValue:[NSNumber numberWithFloat:0.0]];
[anim setToValue:[NSNumber numberWithFloat:1.0]];
[layer addAnimation:anim forKey:@"animateOpacity"];
}
+ [[self imageView] setImage:img];
[layer setOpacity:1.0]; //makes the animation ending value stick
}
Please sign in to comment.
Something went wrong with that request. Please try again.