Guys, could you help me with a good example or a lead where I should start or a right google keyword for this operation.
I want to start to learn about threading in iPhone but I don’t know how to start because I don’t know the right term or keyword to search for.
If you have an example for this example is the best..
Steps :
- I want to load a lot of images. let say 1000 images
- The image will be loaded to a table view in CustomTableCell.
- For each CustomTableCell that visible (let say I will shown only 10 image) I will create a separate thread to load each of the image from an URL so there will be 10 thread.
- If the image is successfully downloaded, I will cache the image (the cache is let say 100 image max),(note: on step 3, I actually will check if the image is available in cache first before download the image from URL).
- But, if the user scroll the table and some of the CustomTableCell now is not visible, and I need to cancel/stop the thread and allocate the thread to new visible CustomTableCell.
The parts that I am confused :
-
about is how to create and stop the thread,
-
how do i know if the cell is not visible anymore,is it on cellForRowAtIndexPath?, if it dequed by the table view the thread is running isn’t ?.
-
Basicly i don’t know how to implement the threading in TableViewCellController?
You may want to take a look at the SDWebImage class library. It I used it for my project and it’s pretty solid. I think it can help with what you’re looking for.
https://github.com/rs/SDWebImage