react-native-navigation的迁移库

UIImage+insets.m 617B

123456789101112131415161718192021
  1. #import "UIImage+insets.h"
  2. @implementation UIImage (insets)
  3. - (UIImage *)imageWithInsets:(UIEdgeInsets)insets {
  4. UIGraphicsBeginImageContextWithOptions(CGSizeMake(self.size.width + insets.left + insets.right,
  5. self.size.height + insets.top + insets.bottom), false, self.scale);
  6. CGContextRef context = UIGraphicsGetCurrentContext();
  7. UIGraphicsPushContext(context);
  8. CGPoint origin = CGPointMake(insets.left, insets.top);
  9. [self drawAtPoint:origin];
  10. UIGraphicsPopContext();
  11. UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
  12. UIGraphicsEndImageContext();
  13. return newImage;
  14. }
  15. @end