Skip to content

Commit

Permalink
Fix crash ios 17
Browse files Browse the repository at this point in the history
  • Loading branch information
tungdoanemddi committed Dec 26, 2023
1 parent e7abbfa commit 3a7db97
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ios/FastImage/FFFastImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ - (void) setImageColor: (UIColor*)imageColor {

- (UIImage*) makeImage: (UIImage*)image withTint: (UIColor*)color {
UIImage* newImage = [image imageWithRenderingMode: UIImageRenderingModeAlwaysTemplate];
UIGraphicsBeginImageContextWithOptions(image.size, NO, newImage.scale);
[color set];
[newImage drawInRect: CGRectMake(0, 0, image.size.width, newImage.size.height)];
newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
UIGraphicsImageRendererFormat *format = [UIGraphicsImageRendererFormat defaultFormat];
UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:image.size format:format];

UIImage *resultImage = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {
CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height);
[color set];
[newImage drawInRect:rect];
}];

return resultImage;
}

- (void) setImage: (UIImage*)image {
Expand Down

0 comments on commit 3a7db97

Please sign in to comment.