ios - Why is my tableview jittery when I scroll -


a tablview cell being setup using following code...

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {       mytableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"mytableviewcell" forindexpath:indexpath];      cell.titlelabel.text = [self.data[indexpath.row] objectforkey:@"node_title"];     cell.taxonomy1label.text = [self.data[indexpath.row] objectforkey:@"group"];       @try {         nsdata *imagedata = [nsdata datawithcontentsofurl:[nsurl urlwithstring:[self.data[indexpath.row] objectforkey:@"image"]]];         cell.thumbnailimageview.image = [uiimage imagewithdata:imagedata];      }     @catch (nsexception * e) {         nslog(@"exception: %@", e);     }      return cell; } 

the try/catch because may or may not have image happening before put in. seems there sort of issue when goes dequeue cell. ideas?

if familiar using third party libraries or cocoapods, common problem, , recommend use of https://github.com/rs/sdwebimage or https://github.com/afnetworking/afnetworking, have uiimageview category methods handle loading images url in background, , not in main thread.

for example using sdwebimage:

[cell.thumbnailimageview sd_setimagewithurl:yourimageurl]; 

this method fetch image in background, not blocking main thread , not make uitableview jitter.


Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -