Disable all Input while UIActivityIndicatorView spinning

mica picture mica · Mar 4, 2012 · Viewed 10.9k times · Source

How can I disable all Input while the UIActivityIndicatorView is spinning?

Thanks

Answer

Rok Jarc picture Rok Jarc · Mar 4, 2012

You can call beginIgnoringInteractionEvents when you start the spinner

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

and endIgnoringInteractionEvents when you stop it.

[[UIApplication sharedApplication] endIgnoringInteractionEvents];

Just make sure your code always comes to the point where you call endIgnoringInteractionEvents, otherwise your app will freeze (from the users point of view).