iOS17问题

2023-11-23  本文已影响0人  Somnus_chh

1、代码中使用了YYText相关库,升级到iOS17之后崩溃问题

对YYAsyncLayer添加一个category,在.m文件中增加代码

+ (void)load{

    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];

    }

}

上一篇 下一篇

猜你喜欢

热点阅读