diff --git a/SDWebImage/UIImage+GIF.m b/SDWebImage/UIImage+GIF.m index a703637..e1ded2a 100755 --- a/SDWebImage/UIImage+GIF.m +++ b/SDWebImage/UIImage+GIF.m @@ -141,17 +141,17 @@ NSMutableArray *scaledImages = [NSMutableArray array]; - UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); - for (UIImage *image in self.images) { + UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); + [image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); [scaledImages addObject:newImage]; + + UIGraphicsEndImageContext(); } - - UIGraphicsEndImageContext(); - + return [UIImage animatedImageWithImages:scaledImages duration:self.duration]; }