Reputation: 51374
I have a UITableView, with each cell containing 4 UIImageView s. I am loading the images asynchronously (using a third party UIImageView extension for asynchronous loading). And also doing the caching. So the table view scrolls freely. But I feel the lag in scrolling when I assign the images to UIImageView.
UIImage *image = [UIImage imageWithContentsOfFile:imageFileURL];
// Scroll is very smooth if I comment out the below line
imageView.image = image;
If I comment out the last line in above code, then the scrolling is faster. The scroll lags when I enable this line. So I need to find a way to assign image to image views without disturbing the scrolling.
One important thing to notice in my app is that, the images are large images, for example, they are above 500x500 px. I am not able to work on the image sizes, as they are coming from server and I don't have any control over it.
My only option is to find out the way to assign large images to the image views without blocking the UI interaction.
I want the scroll to work like Fancy app. I have seen Fancy app, where the scrolling is really smooth and there is not even a bit of a lag.
Is there any optimization tricks that I should follow?
Thanks everyone!
Upvotes: 1
Views: 544
Reputation: 12036
Upvotes: 2