8 Sdwebimage Process

Source: Internet
Author: User

Tag:run   header   set    Callback    emc    memcach   query   mutable    return    

Flowchart:   1.uiimageview + Webcache class sd_setimagewithurl  method for loading images asynchronously.   in the classification, implement the Sd_imageurl property and save the URL. Placeholder is paid to Image2. Sdwebimagemanager (simple interest), call the Downloadimagewithurl method to verify that the URL is nsstring nsurl and convert. Create a Sdwebimagecombinedoperation object to verify that the Self.failedurls contains a series of judgements such as null Url,url. Self.runningoperations add url 3. Sdimagecache Object (property) calls the querydiskcacheforkey  method, the parameter key (URL to string), callback block. With the library key in the Memcache (Nscache) attribute, whether it contains image  if the H cache does not have an asynchronous thread, go to the sandbox to find, if found, extract and convert to image. Then deposit into the Memcache attribute. UIView + webcacheoperation category, Operationdictionary attribute, deposit   uiimageviewimageload = "< Sdwebimagecombinedoperation:0x600000029e40> " 4. After the sandbox executes, callback block (Sdwebimagemanager). The Downloadimagewithurl method for prioritizing calls to the Imagedownloader (Sdwebimagedownloader) property, parameter Url,options,progress,completedblock, The F return value is the Sdwebimagedownloaderoperation class that encapsulates the request    calls Addprogresscallback one (dispatch_barrier_sync) Sync Dim , self in the thread that you are starting. The Urlcallbacks property is used to store Completedblock (Sdwebimagedownloadercompletedblock). Set upTimeout, if not set, default 15s, then encapsulate  nsmutableurlrequest request Network, stitching parameters (cookies,headerd, etc.), operation Priority, Shoulddecompressimages properties and so on. The Downloadqueue (Nsoperationqueue) property adds a Initwithrequest method that operation  calls the Sdwebimagedownloaderoperation object, which is used for downloading. After  c initializes the Sdwebimagedownloaderoperation class, add operation to Nsoperationqueue,  [wself.downloadqueue addoperation:operation];  then calls the Start method in the Sdwebimagedownloaderoperation class (the overridden Nsoperation-start)    Z Knowledge Point: 1. Dispatch_barrier_sync
    1. Nsoperation
The role of the class and its relationship:

8 Sdwebimage Process

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.