Reputation: 6873
I am creating an app which has following workflow.
My question is about first View (loader). This View needs to download a video and an image from some URL and this will be lengthy process so what I want is to start downloading video and image in this View and switch the view to another view while the video and image is being downloaded in background. Is it possible?
I think as Window holds every View so why not to write downloading code inside Window and initiate it with the first view (loader). In the mean time Window will be downloading stuff one ca surf the app. Is it possible?
Upvotes: 0
Views: 348
Reputation: 8990
This is possible. Take a look at NSURLConnection and its methods to create an asynchronous connection which won't block the main Thread. If you prefer to implement a custom socket connection you might want to take a look at NSThread, which will allow you to run code on a detached thread in the background.
Upvotes: 1