Umair A.
Umair A.

Reputation: 6873

IPhone Window vs View

I am creating an app which has following workflow.

  1. The app loads with the PNG splash screen.
  2. I have a Window which holds views so first view is Loader which loads data from a URL.
  3. Another view launches after loader.

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

Answers (1)

Toastor
Toastor

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

Related Questions