ios - Image view makes app slower -



ios - Image view makes app slower -

in ios app have image view in tableviewcell. before adding imageview app performing smooth. slow on devices.

the image saved in database base of operations 64 encode string , decoded image , loaded imageview. decoding done in background thread.

if(info.image !=nil) { uiimage *image = [_imagecache objectforkey:info.threadid]; if (image) { // if have cachedimage sitting in memory already, utilize cell.alignimageview.image = image; } else { uiactivityindicatorview *spinner=[[uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; spinner.center=cell.alignimageview.center; spinner.hideswhenstopped=yes; [cell.alignimageview addsubview:spinner]; [spinner startanimating]; // image in background [self.queue addoperationwithblock:^{ // uiimage nsarray* foo = [info.image componentsseparatedbystring: @","]; nsstring* day = [foo objectatindex: 1]; nsdata *data = [nsdata datafrombase64string:day]; uiimage *image = [uiimage imagewithdata:data]; // if found it, update ui if (image) { [[nsoperationqueue mainqueue] addoperationwithblock:^{ // if cell visible, set image if (cell) [spinner stopanimating]; cell.alignimageview.image = image; }]; [_imagecache setobject:image forkey:info.threadid]; } }]; } }

ios uiimageview base64

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -