Vin Vin - 3 months ago 11
iOS Question

Disabling user interaction of the current view on screen

My app has many views and their respective controllers. Now I have a set of model classes with business logic in them. One of the model classes(subclass of NSObject) has the responsibility of managing security. It's intended function is to listen for a particular instruction from a web server and if a 'disable' message arrives from server, disable the UI for any further usage.

Now the 'disable' message can arrive at any instant during the functioning of the app and any view can be visible on screen. How do I determine which view is visible to the user(from my model class) and disable user interaction for it?

Answer

Maybe you want the whole application to not react at all?

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

use [[UIApplication sharedApplication] endIgnoringInteractionEvents]; to revert this (credits to nerith)