Files
yinmeng-ios/xplan-ios/Appdelegate/YYTextAsyncLayer+XPTextAsyncLayer.m
2023-10-28 19:59:30 +08:00

27 lines
776 B
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// YYTextAsyncLayer+XPTextAsyncLayer.m
// xplan-ios
//
// Created by duoban on 2023/10/28.
//
#import "YYTextAsyncLayer+XPTextAsyncLayer.h"
@implementation YYTextAsyncLayer (XPTextAsyncLayer)
///iOS17bug如果不把方法替换会闪退
+(void)load {
Method xp_displayMethod = class_getInstanceMethod(self, @selector(display));
Method xp_swizzingMethod = class_getInstanceMethod(self, @selector(xp_swizzing_display));
method_exchangeImplementations(xp_displayMethod, xp_swizzingMethod);
}
-(void)xp_swizzing_display{
//通过变量名称获取类中的实例成员变量
if (self.bounds.size.width <= 0 || self.bounds.size.height <= 0) {
self.contents = nil;
return;
} else {
[self xp_swizzing_display];
}
}
@end