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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -