iPhone Development - restrict user interaction with application and show a progress indicator

StackOverflow https://stackoverflow.com/questions/446077

  •  22-07-2019
  •  | 
  •  

Question

I have a case where i pull information from a server. My application has both a tab bar and navigation buttons. I want the application to show a progress indicator and disable all other controls so that user can't jump around while the data is being pulled from the server. How can i achieve this?

One approach i have in mind is to show a transparent view with a progress window (much like the message alert window - which allows the user to interact with the message alert window only). I need help in implementing this approach.

Currently, when the information/data is being pulled from the server i add a UIActivityView to the subview and start animating it. But this does not restrict the user from navigating to other parts of the application.

Was it helpful?

Solution

Stephan suggested the use of UIAlertView with UIProgressView or UIActivityIndicatorView. This solution worked for me, but as discussed with some of the other members of iPhone developer community, this approach is not recommended.

The recommended approach is to use a new view and set its transparancy value to alpha 7 or 8, set it's background to black, and add UIProgressView or UIActivityIndicatorView in this view and use this new view to show progress. No hack is involved in using this technique. While, incase of adding UIActivityIndicatorView to a UIAlertView, your actually performing a non-documented operation (which is not recommended).

Thanks.

OTHER TIPS

Just create an UIAlertView with no buttons, it will prevent any user interaction.

You can add an UIProgressView or UIActivityIndicatorView to your alert if you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top