iPhone – How to do full screen activity status

by: dermdaly

I’ve seen questions about how feed back to a user that something is pending, where you don’t want any input from the user. An example may be making an XML request for data from your iPhone app back to your server. While it is pending you want to show that your app is busy, but don’t want the user to interact with it.

The iPhone SDK has an activity indicator control that is used for such a purpose, but you may want to essentially make the fact that it is pending to be “modal”

Doing it is quite simple. Here’s how:

  1. Create a new view (this can be done in Interface builder) – Lets call it ProgressView. Make it full size, and stick an activity monitor in the middle of it.
  2. Set the view’s background to black, with its alpha set to 0.5. Create an outlet for the activity indicator in the ProgressView’s controller (call it myActivityIndicator)
  3. In the ProgressView’s controller, add the following code:
    - (void)viewDidLoad
    [myActivityIndicator startAnimating];

    - (void)viewWillDisappear: (BOOL)animated
    [myActivityIndicator stopAnimating];

  4. Now. Say we are going to do something that’s going to take some time in our main view controller. Just as we are starting it, we do this:
    [self.view addSubview:progressViewController.view];
  5. When we have completed our long running task, we do this:
    [progressViewController.view removeFromSuperview];

Voila – You have a nice progress indicator “modal dialog” (in old speak).

Of course, there are a number of ways of indicating progress, and you may not wish to disable interaction – Then you just use an activity indicator somewhere obvious in your UI.
Here’s how it looks in my app:


Any other ideas? Please comment.

You May Also Like

We built a product in a lockdown

At the start of the lockdown, around March last year, I have to admit a case of the jitters. I was prospecting on five different projects. Some with existing clients, some with new clients. Our order book was good - but we always have to have an eye on up coming...

read more
The Rise of the Super App

The Rise of the Super App

Imagine being able to chat with your friend through instant messaging, then book dinner, a movie or a gig and pay for everything all from one single app. That’s the power of a super app.  Mobile users worldwide have dedicated apps for specific tasks. This is not...

read more


  1. Pel

    Hey it looks great! Perfect for synchs time in my app! Thanks for the help! Very useful!

  2. Valerio

    Very very interesting post ..do you have a simple code …?? will be very usefulll…!!


  3. Valerio

    very nice ..do you have a simple code …will be very usefull.. cia0

  4. Endoze

    I am having trouble implementing this method with an app that I am developing. I have tried numerous times and various different ways to get a working activity indicator to appear over a webview in my application. The activity indicator is to show network activity in my app. Any chance you could email me and help me out a bit? I would greatly appreciate it!

    • dermdaly

      Hi Endoze,
      Sure – Get in touch via mail and I’ll see if I can help.

  5. Kim

    Do you have an example project of this?

    I can’t seem to get it to work. I have a tabbarcontroller setup with 2 view controllers (for 2 tabs) under the tabbarcontroller. I’m not sure where I add the progressviewcontroller exactly.


  6. Bob

    Thanks for the tip on how to do this.

    However, the problem with this is that if you are loading data from an XML file that you acquire from online is that this screen won’t appear until after that file as loaded.

    You will need to start off a thread for the XML file download.

    Any tips for this?

    • dermdaly

      Hi Bob,
      Surely, all you need to do is to start all of this prior to posting the XML request that obtains the file? I.e. Post XML, start activity indicator..When your data completes (and you delegate’s didFinishLoading gets called, you begin parsing the XML (e.g. using NSXMLParser).
      Then…when the parsing is complete (i.e. you Parser’s delegate’s parserDidEndDocument is called), then you stop the full screen animation.
      Does this make sense? If not, drop me a mail and I’ll see if I can help

  7. Marco

    Your tutorial is very useful, but i’m wondering if you can send me by mail the project sample. It is possible?

    Thanks in advance.

  8. Wolfgang

    Hi, this is a great tip. I nearly understand how it works. My point is where I allocate the object progressViewController and where I release it, especially when I call the ProgressView inside a subview, not the main view.
    MAybe you could send me the example code or give me a hint.
    Thanks for the tip !

  9. Aleksandar


  10. Mony

    I am stuck.
    I have 2 Tabs in Tabbarcontroller, I fetch big Data in device(Local), so I need Activity indicator to run before all data display on the View, but no luck, I tried many way, but all the time my Indicator shows only after the data loaded. Could you help plz. Thanks


Submit a Comment

Your email address will not be published. Required fields are marked *