react-native-navigation的迁移库

UIImage+tint.m 606B

123456789101112131415161718192021
  1. #import "UIImage+tint.h"
  2. @implementation UIImage (tint)
  3. - (UIImage *)withTintColor:(UIColor *)color {
  4. if (@available(iOS 13.0, *)) {
  5. return [self imageWithTintColor:color renderingMode:UIImageRenderingModeAlwaysOriginal];
  6. }
  7. UIImage *newImage = [self imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
  8. UIGraphicsBeginImageContextWithOptions(self.size, NO, newImage.scale);
  9. [color set];
  10. [newImage drawInRect:CGRectMake(0, 0, self.size.width, newImage.size.height)];
  11. newImage = UIGraphicsGetImageFromCurrentImageContext();
  12. UIGraphicsEndImageContext();
  13. return newImage;
  14. }
  15. @end