react-native-navigation的迁移库

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