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:

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Leave a Reply

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