uiimageview - Load image after the json is parsed and presented -


i know how load image without delaying user.

i have been trying load image url, after view appear , user info showed, when user clicks button view showed without delay.

thanks

use nsurlconnection downloading:

nsurlrequest* req = [nsurlrequest requestwithurl:url]; nsoperationqueue* q = [nsoperationqueue mainqueue]; [nsurlconnection sendasynchronousrequest:req queue:q    completionhandler:^(nsurlresponse *resp, nsdata *d, nserror *err) {        if (d) {            uiimage* im = [uiimage imagewithdata:d];            // image        }    }]; 

the download happens on background thread, user not delayed , (most important) main thread not blocked; once download complete, completion handler happens on main thread safe stick image interface or set property or whatever.


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -