Which image caching library for iOS?

前端 未结 7 586
轮回少年
轮回少年 2021-01-30 09:32

I am building a photo album app and find a few image caching libraries, namely:

  • JMImageCache
  • HJCache
  • SDWebImage

What one you\'d re

7条回答
  •  庸人自扰
    2021-01-30 10:17

    Try also APSmartStorage. It automatically caches UIImage/NSData on disk or in memory.

    It has cute Blocks–style API;

        // setup data parsing block
    APSmartStorage.sharedInstance.parsingBlock = ^(NSData *data, NSURL *url)
    {
        return [UIImage imageWithData:data scale:UIScreen.mainScreen.scale];
    };
    ...
    // show some progress/activity
    ...
    // load object with URL
    [APSmartStorage.sharedInstance loadObjectWithURL:imageURL callback:(id object, NSError *error)
    {
        // hide progress/activity
        if (error)
        {
            // show error
        }
        else 
        {
            // do something with object
        }
    }];
    

    It's quite smart and still simple:

    enter image description here

提交回复
热议问题