1234567891011121314151617181920212223242526272829 |
- //
- // YYTextAsyncLayer+Hook.m
- // sansanMassage_Consumer
- //
- // Created by YoMi on 2023/12/14.
- //
- #import "YYTextAsyncLayer+Hook.h"
- @implementation YYTextAsyncLayer (Hook)
- + (void)load {
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- Method a = class_getInstanceMethod(self, @selector(display));
- Method b = class_getInstanceMethod(self, @selector(swizzing_display));
- method_exchangeImplementations(a, b);
- });
- }
- - (void)swizzing_display{
- //通过变量名称获取类中的实例成员变量
- if (self.bounds.size.width<=0 || self.bounds.size.height<=0) {
- self.contents = nil;
- return;
- } else {
- [self swizzing_display];
- }
- }
- @end
|