iPhone – How to do full screen activity status

Written by dermdaly on May 7th, 2009

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.

Comments (13)

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

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


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

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!

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

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.


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?

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

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.

[...] source for the activity indicator example i’ve used is at this link: http://tapadoo.com/2009/iphone-how-to-do-full-screen-activity-status/ Via VN:F [1.9.8_1114]please wait…Rating: 0.0/10 (0 votes [...]

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 !


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

Comment on this post