Loading View

Discussion in 'iOS Programming' started by iPhoneSpain, Dec 7, 2009.

  1. macrumors newbie

    Joined:
    Sep 27, 2009
    #1
    Hello,

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

    http://cocoawithlove.com/2009/04/showing-message-over-iphone-keyboard.html

    The code I use is very simple:
    Code:
    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
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  3. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    If your method is running on the main thread then it'll freeze all UI actions including showing new views.
     
  4. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    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.
     

Share This Page