Hello I am trying to get profile image of facebook user in Table\'s cell.image. But It slows down Scrolling of Table view.Then I used Asynchronous loading of image link But
AsynchronousImageView *image = [[AsynchronousImageview alloc]init];
[image loadImagewithUrlString:getString];
FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:get_string withGetVars:nil];
UIImageView *image_view = [[UIImageView alloc] initWithImage:fb_graph_response.imageResponse];
cell.imageView.image = image_view.image;
This code is creating the described problem ..... try this approch ... once any image is downloaded save it in any temp folder in document directory(make name of ur image such that you can identify each of them uniquely)....and when you have to configure the cell just take the image form tha temp folder every time the method celForRowAtIndexPath
is called .... dont use
UIImageView *image_view = [[UIImageView alloc];
This make no sence here as you are not using it (you are just using its .image
property) .... also if possible collect all you data in viewDidLoad
in that way you can further improve the performance
Its slows down because you are setting the image
every time the cellForRowAtIndexPath:
is called. Add the image to the cell's imageView only inside the if (cell == nil)
block. Then you will see the improvement in scrolling.
Are you sure it's the async image causing problems? Comment the async image part, and see maybe it's the FbGraphResponse part the actual cause.
I see that you're creating an image each time for the graph response and this can cause a slow-down.