How to disable touch events in iOS

There comes the time when your app needs to do something, and while it’s doing that you don’t want the user messing with your interface: no switching to another tab, scrolling around, flicking switches or pressing buttons – because perhaps any of those actions would crash your app.

But how do you do that?

It’s actually super easy – if you know how. UIApplication to the rescue:

This will disable all user input for any view that’s currently displayed, application wide. Animating menu items (such as UIActivityIndicators) will remain animating and visible.

When you’re done, simply call the opposite of the above and you’re back in the touch business:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.