View Full Version : Loading View

Dec 7, 2009, 05:07 PM

I want to show a loading message while I am retrieving some data from the Internet. I am using the code from:


The code I use is very simple:

LoadingView *loadingView = [LoadingView loadingViewInView:[self.view.window.subviews objectAtIndex:0]];

//Retrieve data

[loadingView performSelector:@selector(removeView) afterDelay:5];

The problem is that the loading image only shows up when the retrieve data method has finished and thatīs not what I am looking for. I want the loading window to stay until retrieve data method has finished.

Do i have to call retrieve data in a thread (performSelectorInBackground)???

This must be very easy but I am a bit newbie sorry :S

Thanks in advance

Dec 7, 2009, 05:14 PM
I believe this recent post (http://forums.macrumors.com/showpost.php?p=8924790&postcount=2) holds the answer to your dilemma.

Dec 7, 2009, 05:15 PM
If your method is running on the main thread then it'll freeze all UI actions including showing new views.

Dec 7, 2009, 08:28 PM
You would typically load data from the internet using NSURLConnection's asynchronous methods. You don't need to use a background thread if you do that. You also might be able to avoid the progress indicator, depending on your app's UI design.