I am developing a WatchKit
app, I need to get some images(sometimes 50 thumbnails) to fulfill a Table
. I am downloading the images in the iOS
app and passing them to the WatchKit Extension
, but I am having problems.
First, I have three buttons, if I press one of them I see a Table
with some elements, all of them with image
and label
. The main problem is when I am downloading those images and I press one item to see its detail, the main thread
is blocked and the app doesn't make push
to the DetailsController
until all the images are downloaded.
Has anyone dealt with a Table with many elements and images?? How do you solved this?
Thank you
I ran into a very similar problem and here is how I solved it. I would be interested if anyone has a better solution, but this worked pretty well. Basically, you need to estimate how long the delay will be to transfer each image and make sure you only send them over that often. If you try to send them all at once you will block the main thread.
I tried to boil my code down to just the essential parts for this solution. You won't need to name your images like I do. The key parts are how the queue is used. When you need to stop sending images call
cancelCurrentImageProcessQueue
.