Merge pull request #1280 from atsusy/fix-uiimage-gif

```UIGraphicsBeginImageContextWithOptions``` and ```UIGraphicsEndImageContext``` should be inside the loop for each image
This commit is contained in:
Konstantinos K. 2015-09-29 09:18:33 +03:00
commit 3af1a30ebb
1 changed files with 5 additions and 5 deletions

View File

@ -141,17 +141,17 @@
NSMutableArray *scaledImages = [NSMutableArray array]; NSMutableArray *scaledImages = [NSMutableArray array];
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
for (UIImage *image in self.images) { for (UIImage *image in self.images) {
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
[image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)]; [image drawInRect:CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledSize.width, scaledSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
[scaledImages addObject:newImage]; [scaledImages addObject:newImage];
UIGraphicsEndImageContext();
} }
UIGraphicsEndImageContext();
return [UIImage animatedImageWithImages:scaledImages duration:self.duration]; return [UIImage animatedImageWithImages:scaledImages duration:self.duration];
} }