Reputation: 16849
I have few questions regarding loading images to tableviews
;
I am using ASIHTTPRequest
.
1.) I have a tableview, and i need to load images to it. I have images which has the size of 100KB, 180KB, 450KB, and 2MB. I know that these images are too big, but i have no control over this. I am forced to load these images in the tableview. When i do this, it slows the scrolling, and slows to switch from views to views. So how can i prevent this ? any solution?
2.) Presently i am using SDWebImage
, i am not satisfied with this library because it slows the scrolling etc (even when i use images which is less than 110kb) I need a library that can perform faster actions ?
Upvotes: 0
Views: 1017
Reputation: 23722
You may have to downsample the image to the image view size in the background before displaying it. It will definitely cost you a lot of CPU cycles upfront, but will speed up scrolling. I recommend the ImageIO framework because it has no issues running in non-main threads.
Upvotes: 1
Reputation: 16714
I don't think it's SDWebImage that is slowing your scrolling down. SDWebImage downloads the image in a separate thread, the only thing it really does on the main thread is place the image in the UIImageView and this has to be done on the main thread. I use SDWebImage in a few different UITableViewCells and I have been able to achieve smooth scrolling.
2mb is really large -- you are not going to be able to load that image into a UITableViewCell without seeing some jerk. The fact is that it takes some time for the UIImageView to render that image.
If I were you I would run your app through the Time Profiler instrument and see if you can figure out which lines of code are taking the longest to run in your UITableView or your UITableViewCells.
Upvotes: 0