Reputation: 451
I am loading the images from internet to my TableView cell.
But it's taking time to load it to TableView.
One of my friends suggested using threading but I don't know how it will work in iOS and objective C.
Can anyone tell me how to use threading or threading-like concept to speedup the process?
Upvotes: 1
Views: 1072
Reputation: 20021
Problem
The problem here is image size is a large and hence it take more time to download ,hence when run in main thread will cause blocking of UI performance.
Solution
Actually the solution is to make the download of images asynchronously (in a separate thread) so that the UI which runs in the main thread, is not blocked
Well there are some good libraries to do the task for you .just drop in and enjoy
Upvotes: 1
Reputation: 1807
I think U need to use https://github.com/nicklockwood/AsyncImageView . This utility helps you to load images asynchronously.
See the demo samples as well.
Upvotes: 2
Reputation: 860
use lazy image downloading technique. This will ensure that the available content is displayed first and then the unavailable data is slowly fetched as time passes by!!. But be careful if your cells are reusable then the older image will be displayed there. so I would recommend a place holder image till the original image is ready to display.
Upvotes: 1
Reputation: 29084
Do this tutorial: http://www.raywenderlich.com/4295/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial
Will answers your question as well as you can learn about threading and Grand Central Dispatch(GCD).
Same scenario as you.
Upvotes: 2