0, load the network picture, need to use the URL, so as long as the class provides a way to pass the URL, you can download pictures from the network,
For example, NSData can download images from the network and display them on ImageView:
Choose to load pictures with Sdwebimage!
1. the dependency framework
* Imageio.framework
* Mapkit.framework
2.UIImageView Download the desired header file for the image: Uiimageview+webcache.h
3. call the method to download the image
// URL is a picture path // placeholder is a placeholder picture (a picture that is temporarily displayed when a picture is being downloaded) // Options is the cache policy -(void) Setimagewithurl: (nsurl *) URL placeholderimage: (UIImage *) Placeholder-(void) Setimagewithurl: (nsurl *) URL placeholderimage: (UIImage *) placeholder options: ( sdwebimageoptions) options
4. Cache Policy-sdwebimageoptions
Tacit The hard disk \ Memory Cache is turned on . When you want to change the caching policy, you can specify the following parameters.
* sdwebimageretryfailed download failed will try to download again * sdwebimagelowpriority when Uiscrollview etc is scrolling, Delay Download Picture (place scrollview scroll card)* sdwebimagecachememoryonly only cached in memory, not cached on hard disk * Sdwebimageprogressivedownload image will be displayed slowly at 1.1 (just like a picture on a Web page in a browser)* sdwebimagerefreshcached The disk cache to the system's own nsurlcache to handle, when the same URL corresponding to the picture changes often can use this strategy
General use of sdwebimageretryfailed | Sdwebimagelowpriority