Search code examples
ioscocoa-touchuiactivityindicatorview

Disable all Input while UIActivityIndicatorView spinning


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

Thanks


Solution

  • 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).