YYAnimatedImageView+YYDisplayLayer.m 623 B

123456789101112131415161718192021222324252627
  1. //
  2. // YYAnimatedImageView+YYDisplayLayer.m
  3. // RenJi
  4. //
  5. // Created by lr on 2022/8/23.
  6. //
  7. #import "YYAnimatedImageView+YYDisplayLayer.h"
  8. #import <objc/runtime.h>
  9. @implementation YYAnimatedImageView (YYDisplayLayer)
  10. + (void)load {
  11. Method method1 = class_getInstanceMethod(self, @selector(displayLayer:));
  12. Method method2 = class_getInstanceMethod(self, @selector(rj_displayLayer:));
  13. method_exchangeImplementations(method1, method2);
  14. }
  15. - (void)rj_displayLayer:(CALayer *)layer {
  16. if ([UIImageView instancesRespondToSelector:@selector(displayLayer:)]) {
  17. [super displayLayer:layer];
  18. }
  19. }
  20. @end