美文网首页
SDWebImage cause crash

SDWebImage cause crash

作者: lvzhehappy | 来源:发表于2017-04-10 13:44 被阅读46次

    我们经常在使用tableView加载网络图片,会发现随着条目数越来越多,内存占有率会变得越来越高,然后就会发生崩溃,所以在SDWebImage时一定要记得随时清理cache.解决方法如下:

    - (void)sdWebImageConfig

    {

    [[SDImageCache sharedImageCache] setShouldDecompressImages:NO];

    [[SDWebImageDownloader sharedDownloader] setShouldDecompressImages:NO];

    }

    - (void)didReceiveMemoryWarning

    {

    [[SDImageCache sharedImageCache] clearMemory];

    [[SDImageCache sharedImageCache] cleanDisk];

    [[SDImageCache sharedImageCache] clearDisk];

    [[SDImageCache sharedImageCache] setValue:nil forKey:@"memCache"];

    }

    相关文章

      网友评论

          本文标题:SDWebImage cause crash

          本文链接:https://www.haomeiwen.com/subject/llusattx.html