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

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -