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?

I've done something very similar to this. I disable all user interaction by placing a translucent black view over everything else, which visually distinguishes the fact that the entire UI is disabled, and blocks all touch events. I usually just add this view to the window class after I've added the view controller's view to the window, and then just hide it when it's not needed.

Thanks for your reply Micah. An overlay was the first thing that came to my mind. But since I am already using overlays(for network activity etc.) I didn't want extra view to be managed just for this activity.
–
VinOct 25 '11 at 8:48

You could add a delegate in the class that is listening to the server and so when it gets that message it just calls disable on whomever its delegate is. Whichever view is showing to get the message as well as normal execution until the message is received. If it is a singleton just set the view as the delegate on viewWillAppear.

Another viable option is to use the notification center. So when your class gets the disable message just do

cwieland thanks for your answer. I thought of this way, but it would require lot of similar code to be written(I have around 30 views and view controllers). However +1 for the idea of subclassing UIViewController, I would have done that if my app was not already 90% complete.
–
VinOct 24 '11 at 16:52