Sdwebimage use--a class library to manage remote picture loading

Source: Internet
Author: User

Sdwebimage is hosted on GitHub. Https://github.com/rs/SDWebImage

This class library provides a uiimageview category to support the loading of remote pictures from the network. Features such as cache management, asynchronous download, same URL download count control, and optimization.

When you add a Sdwebimage class library to your project, you must be aware that you need to add mapkit.framework, because Mkannotationview+webcache.h relies on the framework.

Using the demo code

1, Uiimageview use Uiimageview+webcache class (Basic application, a category of Uiimageview)

Premise #import Import uiimageview+webcache.h file, method:

Uiimageview *imageview = [[Uiimageview alloc] init];

[ImageView Setimagewithurl:bannerlasturl Placeholderimage:nil];

2, using the Sdwebimagemanager class: You can do some asynchronous loading work.

Of course your class wants to implement the Sdwebimagemanagerdelegate protocol, and to implement the webimagemanager:didfinishwithimage of the Protocol : method.

3. Standalone asynchronous image download
May be used alone to download asynchronous pictures, you must use downloaderwithurl:delegate: To create a Sdwebimagedownloader instance

This method of Sdwebimagedownloaderdelegate protocol imagedownloader:didfinishwithimage: The download will start immediately and complete when it is invoked.

4. Stand-alone asynchronous image caching

The Sdimagecache class provides an instance of creating an empty cache and uses method Imageforkey: To find the current cache

Storing an image to the cache is a way to use Storeimage:forkey:

By default, images are stored in the memory cache and in the disk cache. If you want to use StoreImage:forKey:toDisk in memory cache only: The third parameter of the method takes a negative value
To replace.

Sdwebimage use--a class library to manage remote picture loading

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.